CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    37

    Error in line of code

    I have created a class which has this line of code :

    private Class class;


    But an error message pops up saying:

    identifier expected and both Class and class are highlighted.

    Why is this and how do I resolve them.

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Error in line of code

    It seems that you try to use the reserved keyword class as an identifier. Try naming your variable something other than class.

  3. #3
    Join Date
    Feb 2003
    Location
    Sunny Glasgow!
    Posts
    258

    Re: Error in line of code

    As wildfrog says, your variable has been given a name which is a reserved word in java.
    Basically, you can't call your class 'class', just like you couldn't call an int 'int', 'return', 'double' or any other reserved word.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured