Question: Java Which one is correct? (1) i = 1; while ( i ++i; } (2) for (int k = 1; k != 10; ++k )

Java

Which one is correct?

(1)

i = 1;

while ( i

++i;

}

(2)

for (int k = 1; k != 10; ++k ) {

System.out.println( (double) k/10 );

}

(3)

switch ( n )

{

case 1:

System.out.println( "The number is 1" );

case 2:

System.out.println( "The number is 2" );

break;

default:

System.out.println( "The number is not 1 or 2" );

break;

}

(4)

The following code should print the values 1 to 10:

n = 1;

while ( n

System.out.println( n++ );

1, 2, 3, or 4?

Java Which one is correct? (1) i = 1; while ( i

Which one is correct? Superclass constructors are not inherited by subclasses. O When a subclass redefines a superclass method by using the same signature, the subclass is said to overload that superclass method. O A Car class has an is-a relationship with the Steering Wheel and Brakes classes. A has a relationship is implemented via inheritance

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!