| Author |
Quickly...valid variable names
|
Matt Kidd
Ranch Hand
Joined: Jul 17, 2002
Posts: 256
|
|
Working through the deitel book and I'm back in chapter 2 reviewing the questions. With regards to variable names I said all these were valid _under_bar_, m928134, t5, j7, her_sales$, his_$account_total, a, b$, c, z, z2, h22 I said all these were invalid 3g, 87, 67h2, h22, 2h. Am I correct?
|
 |
nupur dhawan
Ranch Hand
Joined: Jun 26, 2002
Posts: 71
|
|
You are correct, except for one thing....h22 is a valid variable . In your answer it seems to appear as both valid and invalid, which i'm sure is just a mistake and wanted to point it out to you .
|
Nupur. <br />SCJP2.
|
 |
Matt Kidd
Ranch Hand
Joined: Jul 17, 2002
Posts: 256
|
|
|
yes...typo on my part. Meant to put h22 up with the valid ones. Okay back to the book.
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
While you're reading that book, I recommend that you frequently take a look at The Java Language Specification. Section 3.8 on identifiers answers your question. Another strategy to answer such questions, that I strongly recommend, is that you don't fully believe what the book or anybody here says, and you write a quick test program to answer the question(s). Good Luck.
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: Quickly...valid variable names
|
|
|