Q: You can nest one Java Ternary operator inside another Ternary operator. State TRUE or FALSE.
Solution: no solution
Q: What is the output of the code snippet with the ternary operator? int p=5; System.out.print("Hello "); (p<6)?5:6;
Solution: Unresolved compilation problems: The left-hand side of an assignment must be a variable
Q: What is the output of the Java code snippet with Ternary operator? int num = false?10:20; System.out.println(num);
Solution: no solution
Q: What is the output of the Java code snippet with Ternary operator? String name = "java"; int marks = name == "java"?10:20; System.out.println("Marks=" + marks);
Solution: no solution
Q: What is the output of the Java code snippet with a Ternary operator? String name = "cat"; int marks = name == "Cat"?10:20; System.out.println("Marks=" + marks);
Solution: no solution
Q: What is the output of the Java code snippet with a Ternary operator? String name1 = "pen"; String name2 = "pen"; int marks = name2.equals(name1)?50:80; System.out.println("Marks=" + marks);
Solution: no solution
Q: What is the output of the Java code snippet with a Ternary operator? void show() { int num = true ? getNumber() : 20; System.out.print("TOMATO=" + num); } void getNumber() { System.out.print(30); }
Solution: The "void" type is not allowed as an Operand of a Ternary or Conditional operator.
Q: What is the output of Java code snippet with a Ternary operator or Conditional operator? void show() { String name = true ? getName() : "FRANCE"; System.out.print(name); } void getName() { System.out.print("ENGLAND"); }
Solution: The void functions are not allowed inside a Ternay operator statement.
Q: What is the output of Java code snippet with a Ternary operator? String forest = null; String output = forest != null ? "Goblin" : "Amazon"; System.out.println(output);
Solution: no solution
Q: What is the output of the Java code snippet below? int a = 20, b=30; int total = a>10&&b<10?65:75; System.out.println(total);
Solution: no solution
You Have Score    | /10 |