+ 1
Wgy it shows error?
4 odpowiedzi
+ 4
U missed () while calling get function
+ 3
class Cad{
String name;
public String getName(){
return name;
}
public void setName(String name){
this.name=name;
}
}
public class Program
{
public static void main(String[] args) {
Cad ob=new Cad();
ob.setName("jawahit");
String me=ob.getName();
System.out.print(me);
}
}
+ 2
Make this necessary changes in your program. See u can have only one public class in your program and get name is a function which you need to call
+ 2
Line :: 15 :: getName is a method.. You forgot to use ().. Every method / function must have parentheses after their name
ob.getName()