Questions from Starting Out With Java


Q: What message will the following program display if the user enters 5

What message will the following program display if the user enters 5? What if the user enters 10? What if the user enters 100? import javax.swing.JOptionPane; public class Checkpoint { public static v...

See Answer

Q: Write a void method that displays your full name. The method

Write a void method that displays your full name. The method should be named myName.

See Answer

Q: What is the difference between an argument and a parameter?

What is the difference between an argument and a parameter?

See Answer

Q: Look at the following method header: public static void myMethod

Look at the following method header: public static void myMethod(int num) Which of the following calls to the method will cause a compiler error? 1. myMethod(7); 2. myMethod(6.2); 3. long x = 99; myMe...

See Answer

Q: Suppose a method named showValues accepts two int arguments. Which of

Suppose a method named showValues accepts two int arguments. Which of the following method headers is written correctly? 1. public static void showValues() 2. public static void showValues(int num1, n...

See Answer

Q: Assume the double variable number contains the value 12345.6789.

Assume the double variable number contains the value 12345.6789. Write a statement that uses System.out.printf to display the number as 12,345.68.

See Answer

Q: In Java, method arguments are passed by value. What does

In Java, method arguments are passed by value. What does this mean?

See Answer

Q: What does an object use its fields for?

What does an object use its fields for?

See Answer

Q: When a variable is said to reference an object, what is

When a variable is said to reference an object, what is actually stored in the variable?

See Answer

Q: A string literal, such as "Joe", causes what type

A string literal, such as "Joe", causes what type of object to be created?

See Answer