How many times is the body of the loop repeated and show


1. Static attributes are shared by all instances of a class. True False

2. Which of the following is NOT a primitive data type in Java? a. short b. long c. single d. double e. boolean

3. What is the OO concept that means similar objects can respond to the same message in different ways? a. static b. inheritance c. encapsulation d. information hiding e. polymorphism

4. Which statement displays the contents of a variable *x* of type *int*, and moves the cursor to the next line?

a. System.out.printf("%f", x); b. System.out.printf("%s", x); c. System.out.printf("%n", x); d. System.out.print(x); e. System.out.println(x);

Use the following code to answer questions 12 and 13.

public static void main(String[] args) {

int i = 1; while ( i < 10) {

if ((++i) % 2 ==0)

System.out.printf ("%d ", i);

}

}

5. How many times is the body of the loop repeated?

6. Show the exact output of the code

Solution Preview :

Prepared by a verified Expert
JAVA Programming: How many times is the body of the loop repeated and show
Reference No:- TGS02709933

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)