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


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

Compile error: java: <identifier> expected

X-Received by 10.182.109.200 with SMTP id hu8mr12373253obb.20.1381757606586; Mon, 14 Oct 2013 06:33:26 -0700 (PDT)
X-Received by 10.50.109.170 with SMTP id ht10mr345051igb.14.1381757606387; Mon, 14 Oct 2013 06:33:26 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!i2no11833201qav.0!news-out.google.com!9ni40198qaf.0!nntp.google.com!o2no4292653qas.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.help
Date Mon, 14 Oct 2013 06:33:25 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=77.251.156.172; posting-account=tRhYkQoAAAC4mfP99Qw2QppE0qHeI37Z
NNTP-Posting-Host 77.251.156.172
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <29442c5a-69a2-451a-88f0-25a5e0b9937e@googlegroups.com> (permalink)
Subject Compile error: java: <identifier> expected
From Marc B <marc.at.compass@gmail.com>
Injection-Date Mon, 14 Oct 2013 13:33:26 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.help:2806

Show key headers only | 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