• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SCJP Chapter 1 - Legal Identifiers starting with $ and _

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using the SCJP 1.5 cert book by Kathy and Bert.

Legal Identifiers:
1. must start with a letter, a currency character($), or a connecting character such as the underscore.
2. after the first character, identifiers can contain any combination of letters, currency characters, connecting characters or numbers.

The exam watch says that the rules for legal identifiers are not only for variable names but for ALL java components including methods and classes.

I use NetBeans 5.5.1 and I try to name my class $$__. (2 underscores) It compiles but has a runtime error of: java.lang.NoClassDefFoundError:

Is this a Netbeans problem? It seems like the more I play around with wierd class names, but following the guidelines, some classes run and some don't.


[ January 09, 2008: Message edited by: leo donahue ]
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't use Netbeans, but from that error message, it seems like the problem might have something to do with packages and the CLASSPATH.

I compiled and ran this program at the command prompt, and didn't get an error.

 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Leo, et. al.,

We really, really discourage using an IDE while studying for the SCJP. It's too easy for an IDE to "help" you without telling you, and then you can be left with a misunderstanding about what the compiler or JVM is really doing.

I can tell you for sure that when we create the exam, the entire exam team, crammed into a conference room, is creating every last question using only the command line. Every question is written and tested from the command line. Same goes for all the code and questions in the book.

hth,

Bert
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic