Questions from Starting Out With Java


Q: If a subclass extends a superclass with an abstract method, what

If a subclass extends a superclass with an abstract method, what must you do in the subclass?

See Answer

Q: What is the purpose of an abstract class?

What is the purpose of an abstract class?

See Answer

Q: If a class is defined as abstract, what can you not

If a class is defined as abstract, what can you not do with the class?

See Answer

Q: What is the purpose of an interface?

What is the purpose of an interface?

See Answer

Q: How is an interface similar to an abstract class?

How is an interface similar to an abstract class?

See Answer

Q: How is an interface different from an abstract class, or any

How is an interface different from an abstract class, or any class?

See Answer

Q: If an interface has fields, how are they treated?

If an interface has fields, how are they treated?

See Answer

Q: Write the first line of a class named Customer, which implements

Write the first line of a class named Customer, which implements an interface named Relatable.

See Answer

Q: Convert the while loop in the following code to a do-

Convert the while loop in the following code to a do-while loop: Scanner keyboard = new Scanner(System.in); int x = 1; while (x > 0) { System.out.print("Enter a number:”) ; x = keyboard.nextInt (); }...

See Answer

Q: Write the first line of a class named Employee, which implements

Write the first line of a class named Employee, which implements interfaces named Payable and Listable.

See Answer