diff --git a/Java/practice/Student.class b/Java/practice/Student.class new file mode 100644 index 0000000..bc139cf Binary files /dev/null and b/Java/practice/Student.class differ diff --git a/Java/practice/Student.java b/Java/practice/Student.java new file mode 100644 index 0000000..bee0e03 --- /dev/null +++ b/Java/practice/Student.java @@ -0,0 +1,26 @@ +class Student{ + int data, roll; + String user; + public Student(int no){ + this.data = no; + } + + public Student(int no, String name){ + this(no); + this.roll = no; + this.user = name; + } + + public void display(){ + System.out.println("Data: " + data); + System.out.println("Roll: " + roll); + System.out.println("User: " + user); + } + + public static void main(String[] args) { + Student s1 = new Student(10); + s1.display(); + Student s2 = new Student(10, "Shakti"); + s2.display(); + } +} \ No newline at end of file