Questions from Starting Out With Java


Q: What will the following program segments display? 1. for

What will the following program segments display? 1. for (int count = 0; count < 6; count++) System.out.println(count + count); 2. for (int value = −5; value < 5; value++) System.out.println(value);...

See Answer

Q: What is the difference between a void method and a value-

What is the difference between a void method and a value-returning method?

See Answer

Q: What will the following program display? public class Checkpoint

What will the following program display? public class Checkpoint { public static void main(String[] args) { int num1 = 99; double num2 = 1.5; System.out.println(num1 + " " + num2); myMethod(num1, num2...

See Answer

Q: Look at the following method header. What type of value does

Look at the following method header. What type of value does the method return? public static double getValue(int a, float b, String c)

See Answer

Q: Write the code to set up all the necessary objects for reading

Write the code to set up all the necessary objects for reading keyboard input. Then write code that asks the user to enter his or her desired annual income. Store the input in a double variable.

See Answer

Q: Write the header for a method named days. The method should

Write the header for a method named days. The method should return an int and have three int parameter variables: years, months, and weeks.

See Answer

Q: Write the header for a method named distance. The method should

Write the header for a method named distance. The method should return a double and have two double parameter variables: rate and time.

See Answer

Q: Write the header for a method named lightYears. The method should

Write the header for a method named lightYears. The method should return a long and have one long parameter variable: miles.

See Answer

Q: Is the following line of code a method header or a method

Is the following line of code a method header or a method call? calcTotal();

See Answer

Q: Is the following line of code a method header or a method

Is the following line of code a method header or a method call? public static void calcTotal()

See Answer