Basic Java Language: Difference between revisions

wikademia>Mariehuynh
m spelling
wikademia>Mirwin
Line 59: Line 59:
There are several rules for the naming of your variables. Identifiers can be named using all the letters from A through Z (capital or lowercase, you choose), numbers 0-9 and underscore _ and the dollar sign $. The first character of the identifier cannot be a number, but it can be a letter, _ or $.  
There are several rules for the naming of your variables. Identifiers can be named using all the letters from A through Z (capital or lowercase, you choose), numbers 0-9 and underscore _ and the dollar sign $. The first character of the identifier cannot be a number, but it can be a letter, _ or $.  


You can't create two variables with the same identifier, all identifiers must be unique. You also can't use an identifier that is a Java keyword. Here is a list of all the [http://en.wikipedia.org/wiki/Java_keywords Java Keywords]
You can't create two variables with the same identifier, all identifiers must be unique. You also can't use an identifier that is a Java keyword. Here is a list of all the [http://en.wikipedia.org/wiki/Java_keywords Java Keywords].  [Flashcards for Java keywords] provides some assistance in memorizing the concepts behind specific keywords.
 
==Statements==
==Statements==
A statement in Java is generally a line of code that does something. Statements are ended by a semicolon ;. An example of a statement is the declaration of a variable like we saw before. Another example you will recall from the "Hello World" program we made in Lesson 1.  
A statement in Java is generally a line of code that does something. Statements are ended by a semicolon ;. An example of a statement is the declaration of a variable like we saw before. Another example you will recall from the "Hello World" program we made in Lesson 1.