CS 1401, Quiz #2

Date: Tuesday, January 25, 2005
Name: ______________________________________________________________________
Last 4 digits of UTEP ID #:(it is OK if you do not remember it): ______________________________________________________________________

1. Write down a piece of code that defines two (named) constants of type string whose values are your first name and your last name. Select meaningful identifiers for these constants, and use the book's idea on how to distinguish between a variable and a constant.

Answer: 

  final String FIRST_NAME = "Gang"; 

  final String LAST_NAME = "Xiang"; 

2. Use the constants that you defined in Problem 1 to assign, to the variable fullName, a string that is your full name. For example, if your first name is Gang, and your last name is Xiang, the value of the variable fullName should be Gang Xiang.
Answer: 

  fullName = FIRST_NAME + LAST_NAME; 
3. In a statement System.out.println(fullName) , what is an object, and what is a method?
Answer: 

  System.out is an object

  println is a method

  fullName is also an object  
4. In the following list of terms, mark, by X, the terms described in the book section that you were supposed to read by today:
input X 

application X 

testing X 

if statements

two-dimensional arrays