Marc B
2013-10-14 13:33:25 UTC
Hello,
I am new to Java. I create a reference variable, and then call a final method on that variable but on compilation I get this error:
java: <identifier> expected
pointing to the last line - p.sing();
This is my code:
class MyClass{
public static void main(String[] args){
}
}
class Person {
final void sing() {
System.out.println("la..la..la..");
}
}
class Professor {
final void singalong() {
System.out.println("la..la..la..");
}
Person p = new Person();
p.sing();
}
What does the error mean? What identifier needs to be present on that line p.sing();???
Thanks,
Marc
I am new to Java. I create a reference variable, and then call a final method on that variable but on compilation I get this error:
java: <identifier> expected
pointing to the last line - p.sing();
This is my code:
class MyClass{
public static void main(String[] args){
}
}
class Person {
final void sing() {
System.out.println("la..la..la..");
}
}
class Professor {
final void singalong() {
System.out.println("la..la..la..");
}
Person p = new Person();
p.sing();
}
What does the error mean? What identifier needs to be present on that line p.sing();???
Thanks,
Marc