What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 5;
int y = x++;
System.out.println(y);
}
}
Which of the following is NOT a primitive data type in Java?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What is the result of the following code?
String str = "Hello World";
System.out.println(str.length());
What is the output of the following code?
int x = 10;
int y = 5;
boolean result = (x > y) ? true : false;
System.out.println(result);
What is the output of the following code?
int x = 6;
int y = 3;
System.out.println(x / y);
Which of the following statements is true about Java interfaces?
What is the output of the following code?
int x = 5;
int y = 10;
int z = ++x + y--;
System.out.println(z);
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 5;
int y = 2;
int result = x % y;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 3;
int y = 4;
boolean result = x == y;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
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");
}
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 5;
int y = 10;
if (x > y) {
System.out.println("x is greater than y");
} else if (x < y) {
System.out.println("x is less than y");
} else {
System.out.println("x is equal to y");
}
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 10;
int y = 5;
int z = 7;
int result = (x > y) ? (x > z) ? x : z : (y > z) ? y : z;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 10;
int y = 5;
int result = x / y;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 6;
int y = 3;
boolean result = (x % y == 0) ? true : false;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 5;
int y = 10;
boolean result = (x < y) ? true : false;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 10;
int y = 5;
int z = 7;
int result = (x < y) ? (x < z) ? x : z : (y < z) ? y : z;
System.out.println(result);
}
}
What is the output of the following code?
public class Main {
public static void main(String[] args) {
int x = 5;
int y = 10;
int result = (x > y) ? x++ : y--;
System.out.println(result);
}
}