Exam 5: Defining Classes Ii

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

To create a package,you must add a package statement at the ____________ of each class file.

Free
(Multiple Choice)
4.8/5
(33)
Correct Answer:
Verified

A

Write ONE Java statement that computes and displays a random number between 1 and 25.

Free
(Essay)
4.8/5
(42)
Correct Answer:
Verified

System.out.println("Random number between 1 and 25 " + Math.round((Math.random()* 25)));

Wrapper classes are provided for all primitive Java types except Boolean.

Free
(True/False)
4.7/5
(36)
Correct Answer:
Verified

False

Write a statement that creates and initializes a static variable named salesTax to 7.59.

(Short Answer)
4.8/5
(36)

When you use the assignment operator with variables of a class type,you are assigning a:

(Multiple Choice)
4.7/5
(34)

Wrapper classes provide a class type corresponding to each of the primitive types so that you can have class types that behave somewhat like primitive types.

(True/False)
4.7/5
(38)

Does an object created with a copy constructor reference the same memory location that the original object references? Explain.

(Essay)
4.8/5
(38)

The method trim of the String class trims off:

(Multiple Choice)
4.8/5
(37)

Write a Java method that returns true if and only if a character is a digit or a letter.The method should display appropriate feedback to the console.

(Essay)
4.8/5
(35)

Explain in detail how main memory works.

(Essay)
4.9/5
(34)

Explain how a package is named in Java.

(Essay)
4.7/5
(30)

Converting from a value of primitive type to a corresponding object of its associated wrapper class is called:

(Multiple Choice)
4.9/5
(41)

Primitive types are reference types.

(True/False)
4.9/5
(36)

To use a package,the program must contain an import statement that names the package.

(True/False)
4.9/5
(42)

Add a constructor and a copy constructor to the Book class created in question #13.

(Essay)
4.8/5
(27)

An example of secondary memory is:

(Multiple Choice)
4.8/5
(28)

All versions of Java support automatic boxing.

(True/False)
4.8/5
(41)

null can be used:

(Multiple Choice)
4.9/5
(37)

Write a statement that creates a constant variable named TAX_RATE.The tax rate is 8.25%.

(Essay)
4.9/5
(35)

The program included in the Java SDK that allows a programmer to separate the class interface from the class implementation is called:

(Multiple Choice)
4.9/5
(32)
Showing 1 - 20 of 46
close modal

Filters

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