Exam 3: Using Classes and Objects

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Rewrite the following five assignment statements into a single statement using prefix and postfix increment and decrement operators as necessary. Assume all variables are int variables. x = y + 1; y = y + 1; z = z - 1; x = x - z; x = x + 1;

(Short Answer)
4.8/5
(36)

For the program to get a name interactively a Scanner object must be instantiated. Write the Java statement to do this.

(Essay)
4.9/5
(42)

Why does one set up a containment hierarchy?

(Essay)
4.9/5
(35)

What happens if you attempt to use a variable before it has been initialized?

(Multiple Choice)
4.8/5
(33)

The main difference between a frame and a panel is

(Multiple Choice)
4.7/5
(33)

These two ways of setting up a String yield identical results: a) String string = new String("123.45"); b) String string = "" + 123.45;

(True/False)
4.9/5
(40)

Layout managers are associated with

(Multiple Choice)
4.8/5
(26)

What is the purpose of the ImageIcon class?

(Essay)
4.9/5
(35)

Which of the following GUI components is used to accept input into a JFrame?

(Multiple Choice)
4.8/5
(38)

What is autoboxing?

(Essay)
4.7/5
(39)

The advantage(s) of the Random class' pseudo-random number generators, compared to the Math.random method, is that

(Multiple Choice)
4.9/5
(30)

If two variables contain aliases of the same object then

(Multiple Choice)
4.8/5
(33)

Write a statement using a method to guarantee that the initial will be a capital letter.

(Essay)
4.8/5
(32)

In Java, the symbol "=" and the symbol "==" are used synonymously (interchangeably).

(True/False)
4.8/5
(38)

Say you write a program that makes use of the Random class, but you fail to include an import statement for java.util.Random (or java.util.*). What will happen when you attempt to compile and run your program.

(Multiple Choice)
4.9/5
(39)

JOptionPane is a class that provides GUI

(Multiple Choice)
4.8/5
(38)

Autoboxing is

(Multiple Choice)
4.8/5
(39)

In Java, "instantiation" means

(Multiple Choice)
4.7/5
(34)

The Swing package

(Multiple Choice)
4.9/5
(33)

What is the difference between a heavyweight and a lightweight container?

(Essay)
4.8/5
(44)
Showing 21 - 40 of 58
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)