Java Reference
In-Depth Information
APPENDIX 5
Cheat Sheets
Enthused by reading a chapter, you're sitting down to write some code only
to get stuck: how do you do that thing in Java, again? It happens to all of us
when learning a new language. One of the first things I do when trying to
work in a new language is to find or write a “cheat sheet” to help me remember
the details.
Java Language
This is not a complete list of every Java feature—it's just the important bits
you might need, shown as examples in most cases.
Literal Data Types
Whole numbers
inti=7;i=-5;
Numbers with fractional parts
doublenum=3.14;num=0.01;num=-3e15 (means -3 times 10 to the 15th power)
True or false
boolean shouldGetUp=true; shouldGetUp=false (or any Boolean expression that
resolves to true or false )
String of text characters
Strings="Hello";
Array
String[]grades={"A","B","C","D","F","Inc"};
 
 
 
Search WWH ::




Custom Search