Primitive Data Types and Basic Language Rules for Java - A Few More Rules (
Page 4 of 4 )
Java likes to separate the men from the boys, the hair from your head, and the code that you write. To do this, we use separators (didn't see that coming did you?).
Separators
Below is a list of separators and their functions.
|
How it Looks |
Name |
Function |
|
. |
Period |
Separates package names from subpackages and classes. Can also be used to separate a variable or method from a reference variable. |
|
; |
Semicolon |
Ends statements. |
|
, |
Comma |
Separates identifiers when declaring variables. |
|
{} |
Braces |
No not for your teeth. Contains the values of initialized arrays. Also for declining a block of code, classes, methods, local scopes. |
|
[] |
Brackets |
For declaration of array types or dereferencing array values. |
|
() |
Parentheses |
Holds lists of parameters in method definition, defining precedence in expressions, holding expressions in control statements, and encasing cast types |
Keywords
As part of its diverse vocabulary, Java has 49 reserved keywords. These keywords cannot be used to name a variable, class, or method, and will not magically open doors (rely on good ole' "open sesame" for that one). You want to see what they look like in a table? Well here they are:
|
abstract |
assert |
boolean |
break |
byte |
case |
catch |
|
char |
class |
const |
continue |
default |
do |
double |
|
else |
extends |
final |
finally |
float |
for |
goto |
|
if |
implements |
import |
instanceof |
int |
interface |
long |
|
native |
new |
package |
private |
protected |
public |
return |
|
short |
static |
strictfp |
super |
switch |
synchronized |
this |
|
throw |
throws |
transient |
try |
void |
volatile |
while |
Final Notes
That concludes this episode of Beginning Java Programs. In the next article we will discuss Operators and putting those lazy variables to work.