18 what is a single line of java code to make an object


18. what is a single line of Java code to make an object called car from the Vehicle class. Assume the class has a default constructor.

19. Assume x is 0. What is the output of the following statement? if (x > 0) System.out.print("red"); else if (x < 0) System.out.print("white"); else System.out.print("blue");

20. What is the value of j after the following code has executed? int i = 1; for (int j = 1; j <= 10; j += 2) { i++; }

21. How many times is "Hello" displayed? count = 0; while (count == 3) { System.out.print("Hello"); count++; }

Use the partial class definition to answer questions 22 to X below. public class Movie { public String title; public int year; }

22. What is constructor for the Movie class that will accept two input arguments as the values of the attributes.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: 18 what is a single line of java code to make an object
Reference No:- TGS02892487

Now Priced at $10 (50% Discount)

Recommended (95%)

Rated (4.7/5)