What is a single line of java code to make an object called


1. 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.

2. 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");

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

4. 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; }

5. 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
JAVA Programming: What is a single line of java code to make an object called
Reference No:- TGS02709939

Now Priced at $10 (50% Discount)

Recommended (97%)

Rated (4.9/5)