Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
What is the output of the following code?
public class Test { public static void main(String args[]) { int[] numbers = {1, 2, 3}; System.out.println(numbers[1]); } }
1
2
3
IndexOutOfBoundsException
myVariable
$variable
2variable
_variable
public class Test { public static void main(String args[]) { System.out.println("Hello" + " World"); }
Hello
World
Hello World
HelloWorld
while
for
do-while
if
class
new
object
create
public class Test { public static void main(String args[]) { int x = 5; System.out.println(x++); } }
4
5
6
7
public
private
protected
static
int
boolean
double
string
public class Test { public static void main(String args[]) { int x = 10; int y = 5; System.out.println(x > y); } }
0
public class Test { public static void main(String args[]) { int x = 10; int y = 5; if(x > y) { System.out.println("x is greater than y"); } else { System.out.println("x is less than or equal to y"); } } }
x is greater than y
x is less than or equal to y
Both statements are printed
No output