Help needed on basics of Methods- Written non written
I have problem with this code, it is throwing error on g.get(): this particular line
String str = g.get(); // "HI GENEVIVE"
This is the code
class genevive {
String get( ) {
return "Hi Genive";
}
}
public class Test1 {
public static void main(String[] args) {
Genive g = new Genive();
String str = g.get(); // "HI GENEVIVE"
System.out.println(str);
}
}
Re: Help needed on basics of Methods- Written non written
Please post your code in code tags.
The class name and reference to it are not the same. Not only are they spelled differently, but case also matters.