Java Reference
In-Depth Information
Exercises
1. Write a complete Java program that prints the following output:
//////////////////////
|| Victory is mine! ||
\\\\\\\\\\\\\\\\\\\\\\
2. Write a complete Java program that prints the following output:
\/
\\//
\\\///
///\\\
//\\
/\
3. Write a complete Java program that prints the following output:
A well-formed Java program has
a main method with { and }
braces.
A System.out.println statement
has ( and ) and usually a
String that starts and ends
with a " character.
(But we type \" instead!)
4. Write a complete Java program that prints the following output:
What is the difference between
a ' and a "? Or between a " and a \"?
One is what we see when we're typing our program.
The other is what appears on the "console."
5. Write a complete Java program that prints the following output:
A "quoted" String is
'much' better if you learn
the rules of "escape sequences."
Also, "" represents an empty String.
Don't forget: use \" instead of " !
'' is not the same as "
Search WWH ::




Custom Search