AmbitionBox
Discover Best Places to work in India
Discover best places to work
Compare & find best workplace
Bring your workplace to life
Highlight your company's perks
Read reviews for 6L+ companies
Rate your former or current company
Discover salaries for 8L+ companies
Calculate your take home salary
Check your market value
Help other jobseekers
Read interviews for 90K+ companies
Interviews questions for 1K+ colleges
Contribute your interview questions
Java Programming
1.What happens when the following code is compiled and run. Select the one correct answer.
for(int i = 1; i < 3; i++) for(int j = 3; j > i; j--) assert i!=j {System.out.println(i); }
The number 1 gets printed with AssertionError
The class compiles and runs, but does not print anything
The program generates a compilation error
What happens when the following code is compiled and run. Select the one correct answer.
for(int i = 1; i < 3; i++) for(int j = 3; j >= 1; j--) assert i!=j : i;
The number 2 gets printed with AssertionError
The number 3 gets printed with AssertionError
for(int i = 1; i < 4; i++) for(int j = 1; j < 4; j++) if(i < j) assert i!=j : i;
Which of the following statement is true about the assert statement. Select the one correct answer
If a Java class contains assert statements, then it must be compiled with -1.4 option
When a program having assertions is run, -assertion option must be specified, otherwise the assertions get ignored
A possible syntax of assert statement is assert logical_expression If logical_expression evaluates to true, the program generates an AssertionError
assert logical_expression
The program terminates on its first AssertionError
Join India’s largest community to research company culture
Are you a student or working professional?
Student/Never worked
I am a student/I have never worked
Working Professional
I am working/I have worked before
What are your preferred job locations?
Popular Cities
Other Cities
Follow your preferred designations/job profiles
Suggestions based on your job profile
vs
Similar Companies