Lesson 2 Java Fundamentals
Lesson 2 Java Fundamentals
Java Fundamentals
Short Review
• The value inside the parenthesis will be sent to the output device (in this case,
a string).
• The println method places a newline character at the end of whatever is
being printed out. However, the print statement does not put a newline
character at the end of the output.
Java Escape Sequences (1 of 2)
\t tab Causes the cursor to skip over to the next tab stop
Causes the cursor to back up, or move left, one
\b backspace
position
value = 5;
System.out.print("The value is ");
System.out.println(value);
}
}
2.3 Variables and Literals (2 of 2)
The + Operator
digits of accuracy
0.00072 7.2E−4
4 fourth power.
7.2 times 10 the negative
7.2×10
2,900,000 6
2.9E6
2.9
2.9 times ×10
10 to the sixth power.
Higher Priority
Lower Priority
•
2.6 Combined Assignment Operators
2.7 Creating Constants
• This is the method that all other objects must use when
they are created.
See example: StringDemo.java
The String Methods
Comment Description
Style
Single line comment. Anything after the // on the line will be
//
ignored by the compiler.
Block comment. Everything beginning with /* and ending with the
/* … */ first */ will be ignored by the compiler. This comment type cannot
be nested.
Javadoc comment. This is a special version of the previous block
comment that allows comments to be documented by the
/** … */ javadoc utility program. Everything beginning with the /** and
ending with the first */ will be ignored by the compiler. This
comment type cannot be nested.
2.10 Commenting Code (2 of 3)