Solutions to the Try It Out Exercises in Java For Dummies, 7th Edition
by Barry Burd

Chapter 3: Using the Basic Building Blocks

In this chapter:

No more baked beans

Java displays the text No more baked beans

Public instead of public

You get an error message. Java is case-sensitive, and the correct keyword is public (all lowercase).

Main instead of main

The program doesn't run. In a Java program, the starting point for execution is method named main (with all lowercase letters).

system instead of System

You get an error message. Java is case-sensitive. Java knows what System.out means because System.out is part of the Java library code. But Java doesn't know what system.out is.

Change the indendation

The code runs correctly. Java doesn't care about line breaks. (Actually, there's an exception. You can't put a line break in the middle of a double-quoted string of characters.)

print1n with a digit 1 near the end

You get an error message. Java doesn't know what print1n means.

Missing semicolon

You get an error message. In Java, you terminate each statement with a semicolon.

Additional semicolons

For most of the places where you add a semicolon, nothing bad happens. The program still runs correctly. In Java, an extra semicolon is considered to be an extra empty statement -- a statement that does nothing. And that's okay.

" Use a straight quote \", not a curly quote \u201D"

Java displays the text Use a straight quote ", not a curly quote ” which ends with a curly quotation mark. In Java, \" represents a straight quotation mark to be displayed on the screen, and \u201D represents a curly quotation mark to be displayed on the screen.