Questions from Starting Out With Java


Q: Look at the UML diagram in Figure6-17 and answer the

Look at the UML diagram in Figure6-17 and answer the following questions: 1. What is the name of the class? 2. What are the fields? 3. What are the methods? 4. What are the private members? 5. What ar...

See Answer

Q: Assume that limo is a variable that references an instance of the

Assume that limo is a variable that references an instance of the class shown in ­Figure6-17 . Write a statement that calls setMake and passes the argument "Cadillac".

See Answer

Q: What does the key word new do?

What does the key word new do?

See Answer

Q: What is an accessor? What is a mutator?

What is an accessor? What is a mutator?

See Answer

Q: What is a stale data item?

What is a stale data item?

See Answer

Q: Assume that r1 and r2 are variables that reference Rectangle objects,

Assume that r1 and r2 are variables that reference Rectangle objects, and the following statements are executed: r1.setLength(5.0); r2.setLength(10.0); r1.setWidth(20.0); r2.setWidth(15.0); Fill in th...

See Answer

Q: A program has a float variable named total and a double variable

A program has a float variable named total and a double variable named number. Write a statement that assigns number to total without causing an error when compiled. Answer: total = (float)number;

See Answer

Q: How is a constructor named?

How is a constructor named?

See Answer

Q: What is a constructor’s return type?

What is a constructor’s return type?

See Answer

Q: What are an object’s methods?

What are an object’s methods?

See Answer