Skip to content

Commit

Permalink
java-practice-func-overload
Browse files Browse the repository at this point in the history
  • Loading branch information
rajjitlai committed Nov 24, 2024
1 parent 8b913b1 commit 9d11c33
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Binary file added Java/practice/Student.class
Binary file not shown.
26 changes: 26 additions & 0 deletions Java/practice/Student.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit 9d11c33

Please sign in to comment.