You are not logged in.
Pages:: 1
#1 2016-11-09 06:18:01
Sun Certified Java Programmer (SCJP) Quiz Question.
Java Quizzes Sun Certified Java Programmer (SCJP)
Question:
What happens when the following code is compiled and run.
Select the one correct answer.
for(int i = 2; i < 4; i++)
for(int j = 2; j < 4; j++)
assert i!=j : i;
Options are
Option A):
compile error
Option B):
The number 3 gets printed with AssertionError
Option C):
The class compiles and runs, but does not print anything.
Option D):
The number 2 gets printed with AssertionError
Correct Answer is Option D):
The number 2 gets printed with AssertionError
Explanation:
When i and j are both 2, assert condition is false, and AssertionError gets generated. .
Online Web Tutorials And Interview Questions With Answers Forum:
https://globalguideline.com/forum/
Offline
2016-11-09 06:18:01
- Advertisement
- Ads By Google
Re: Sun Certified Java Programmer (SCJP) Quiz Question.
\n