Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: <identifier> expected

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    25
    My Mood
    Confused
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default <identifier> expected

    So I am doing some questions for my programming class using blueJ and I am not very good

    But on the question we have to complete a code but I have started abit and got:

    public class Screen
    {
    private int xRes;
    private int yRes;

    public Screen(int xRes, yRes)
    {
    .....
    }
    public int numberOfPixels()
    { // product of xRes and yRes
    .....
    }
    public void clear(boolean invert) {
    .....
    }
    }

    But when I try to compile it says '<identifier> expected'
    and I am not sure what it means

    any help?


  2. #2
    Junior Member nnovello's Avatar
    Join Date
    Nov 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: <identifier> expected

    public Screen(int xRes, yRes)

    needs to be:

    public Screen(int xRes, int YRes)

    Why are you declaring these global variables as private int above?
    They are in a different scope than the parameter variables and are not the same.
    /***************************
    *
    * Nick Novello
    * University At Buffalo
    *
    ***************************/

Similar Threads

  1. java.lang.IllegalArgumentException: Identifier not found
    By aussiemcgr in forum What's Wrong With My Code?
    Replies: 9
    Last Post: March 9th, 2012, 04:48 AM
  2. ';' expected?
    By noobish in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 21st, 2009, 11:55 AM
  3. [SOLVED] Java error "Another <identifier> expected"
    By bruint in forum What's Wrong With My Code?
    Replies: 23
    Last Post: May 1st, 2009, 08:47 AM