Java Reference
In-Depth Information
Review Questions
1.
What is the minimum Java source code needed to define a class?
2.
What is the syntax to define a String variable?
3.
Where must the package statement appear in the class?
In a method header, where is the keyword void specified?
4.
5.
How can you tell if there are unsaved changes in a source code file?
6.
When an object is instantiated, which is done first: the constructor is executed or class
variables are created?
7.
Determine which of the following statements are valid and which are invalid:
String coolStuff
public displayCoolStuff() {}
String veryCoolStuff("ice");
string veryCoolStuff;
String extremelyCoolStuff = new String(liquid nitrogen);
8.
What is a token?
Review Exercise
Overview
In the exercises, you will create a Java-based application for a company called TNT Salvage. TNT receives unwanted
consumables (food, kitchen and laundry products, toiletries, etc.) from large retail organizations, repackages them,
and sells them to smaller retail outlets at a significant discount. Throughout the chapter exercises, you will create an
application that accepts information about shipments from the large retailers.
Detail
In this first exercise, you will create a Java class called ShipmentApp that creates and uses five variables to store
shipment information and displays that information.
1.
Start RAD and create a new Java project called ReviewEx.
2.
In ReviewEx, create a package called c1.
3.
In c1, create a public class called ShipmentApp with a main method.
At this point, the code should consist of:
a package statement
a class header
the opening and closing braces for the class body
a main method header
the opening and closing braces for the main method body
 
Search WWH ::




Custom Search