Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2806

Compile error: java: <identifier> expected

Newsgroups comp.lang.java.help
Date 2013-10-14 06:33 -0700
Message-ID <29442c5a-69a2-451a-88f0-25a5e0b9937e@googlegroups.com> (permalink)
Subject Compile error: java: <identifier> expected
From Marc B <marc.at.compass@gmail.com>

Show all headers | View raw


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

Back to comp.lang.java.help | Previous | NextNext in thread | Find similar


Thread

Compile error: java: <identifier> expected Marc B <marc.at.compass@gmail.com> - 2013-10-14 06:33 -0700
  Re: Compile error: java: <identifier> expected Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-10-14 10:11 -0400
    Re: Compile error: java: <identifier> expected Marc B <marc.at.compass@gmail.com> - 2013-10-14 08:23 -0700
  Re: Compile error: java: <identifier> expected Roedy Green <see_website@mindprod.com.invalid> - 2013-10-21 20:33 -0700
  Re: Compile error: java: <identifier> expected abiolaquadri1987@gmail.com - 2014-11-07 07:07 -0800

csiph-web