-2
我想從用戶那裏獲取該程序的值,即直接來自用戶的值爲Name
,roll
,salary
。來自鍵盤的輸入
如何做到這一點?
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);
}
}
任何人都可以幫忙嗎?
什麼是這種語言? – Taosique
這是用於Java語言的 –