I want to take values from user for this program, that is value for Name
, roll
, salary
directly from an user.
How to do that?
public class MethodOverloadingPractice {
public void display(String name){
System.out.println("Name is "+name);
}
public void display(String name, int roll){
System.out.println("Name is " + name + "Roll is " + roll);
}
public void display(String name, int roll, double salary){
System.out.println("Name is " + name + "Roll is " + roll + "Salary is " + salary);
}
}
class MOP{
public static void main(String[] args){
MethodOverloadingPractice obj = new MethodOverloadingPractice();
obj.display("Jannatin");
obj.display("Jannatin", 101);
obj.display("Jannatin", 101, 150);
}
}
Can anyone please help?