题目内容

What is the output of the following code:for ( ; false ; ) System.out.println("Welcome to Java");

A. does not print anything.
B. prints out Welcome to Java one time.
C. prints out Welcome to Java two times.
D. prints out Welcome to Java forever.

查看答案
更多问题

What is the output of the following code:for ( ; ; ) System.out.println("Welcome to Java");

A. prints out Welcome to Java two times.
B. prints out Welcome to Java forever.
C. does not print anything.
D. prints out Welcome to Java one time.

In a for statement, if the continuation condition is blank, the condition is assumed to be ______.

A. true
B. false

Analyze the following code:import javA.util.Scanner;public class Test { public static void main(String[] args) {int sum = 0;for (int i = 0; i < 100000; i++) {Scanner input = new Scanner(System.in);sum += input.nextInt();}}}

A. The program compiles and runs, but it is not efficient and unnecessary to execute the Scanner input = new Scanner(System.in); statement inside the loop. You should move the statement before the loop.
B. The program compiles, but does not run because there is not prompting message for entering the input.
C. The program does not compile because the Scanner input = new Scanner(System.in); statement is inside the loop.
D. The program compiles, but does not run because the Scanner input = new Scanner(System.in); statement is inside the loop.

A variable declared in the for loop control can be used after the loop exits.

A. true
B. false

答案查题题库