16th Apr 2021, 10:31 AM
Jawahirullah
Jawahirullah - avatar
4 odpowiedzi
+ 4
U missed () while calling get function
18th Apr 2021, 10:09 AM
kreddyt
kreddyt - avatar
+ 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); } }
16th Apr 2021, 10:34 AM
Atul [Inactive]
+ 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
16th Apr 2021, 10:35 AM
Atul [Inactive]
+ 2
Line :: 15 :: getName is a method.. You forgot to use ().. Every method / function must have parentheses after their name ob.getName()
18th Apr 2021, 8:02 AM
Mohammad Mehedi Hasan
Mohammad Mehedi Hasan - avatar