Question 21
EasyWhat is the output of this program?
public class Main {
{
System.out.println( + + );
}
}
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Programming Languages
What is the output of this program?
public class Main {
{
System.out.println( + + );
}
}
1020Hi
30Hi
Hi30
Hi1020
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
int x = 5;
System.out.println(x++ + ++x);
}
}
10
13
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
System.out.println(10 % 3 == 1);
}
}
false
1
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
String s = "Java";
System.out.println(s.charAt(2));
}
}
v
a
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
int[] a = {4, 5, 6};
System.out.println(a.length);
}
}
4
6
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
System.out.println(Math.max(3, 8) + Math.min(3, 8));
}
}
11
3
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
String s = "abc";
System.out.println(s.toUpperCase() + s);
}
}
ABC
Compilation error
Sign up free to see the answer and a step-by-step explanation.
What is the output of this code?
String s1 = "hello";
String s2 = "hello";
System.out.println(s1 == s2);
true
false
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
String a = "java";
String b = new String("java");
System.out.println((a == b) + " " + a.equals(b));
}
}
true true
false true
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
public class Main {
public static void main(String[] args) {
String a = "java";
String b = "java";
System.out.println(a == b);
}
}
null
Error
Sign up free to see the answer and a step-by-step explanation.
11
12
true
Compilation error
J
va
3
2
8
38
abc ABC
ABCabc
Compilation error
Runtime error
false false
true false
false
true