Question: 32. Write a single line of Java code to create an object called loc from the Location class. Assume the class has a default constructor.
32. Write a single line of Java code to create an object called loc from the Location class. Assume the class has a default constructor.
33. Assume x is 0. What is the output of the following statement? if (x > 0) System.out.print("negative"); else if (x < 0) System.out.print("zero"); else System.out.print("positive");
34. What is the value of j after the following code has executed int i = 1; int j = 1; while (i < 3) { i++; j *= 5; }
35. How many times is Hello displayed? (1 Point) count = 0; do { System.out.println("Hello"); count++; } while (count == 5);
Use the following array definition for questions 36 and 37: String[] countries = {"United States", "Canada", "Mexico"}; 36. What is the value of countries.length? 37. Which index value is used to retrieve the string "Mexico" from the array?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
