Wednesday, September 14, 2011

Chapter 1 Practice Code

Here are some generic codes, along with what they print:


System.out.println("\"Quotes\"");
System.out.println("Slashes \\//");
System.out.println("How '\"confounding' \"\\\" it is!");

System.out.println("name\tage\theight");
System.out.println("Archie\t17\t5'9\"");
System.out.println("Betty\t17\t5'6\"");
System.out.println("Jughead\t16\t6'");

System.out.println("Shaq is 7'1");
System.out.println("The string \"\" is an empty message.");
System.out.println("\\'\"\"");

Here is the output generated:

"Quotes"
Slashes \//
How '"confounding' "\" it is!
name age height
Archie 17 5'9"
Betty 17 5'6"
Jughead 16 6'
Shaq is 7'1
The string "" is an empty message.
\'""

This may seem like a lot of useless tidbits, but the main point was to decide which characters do what in java. We learned /t is some kind of table separating function (mind you I'm doing these without any prior knowledge so be gentle if I'm way off. The rest seemed pretty straightforward.

This little post will help you solve the problems:
confounding, Archie, and Shaq on the site for Building Java Programs: Practice-It!

0 comments:

blogger templates | Make Money Online