Computer Applications
Users must be above 10 years to open a self-operated bank account. Write this logic using a ternary operator and store the result (the eligibility message) in a String variable named idStatus and print it.
Java Conditional Stmts
2 Likes
Answer
String idStatus = (age > 10) ? "Eligible" : "Not Eligible";
System.out.println(idStatus);
Answered By
1 Like
Related Questions
Evaluate the Java expression:
x = a * b % (++c) + (++a) + (--b);if a = 7, b = 8, c = 2
Write the Java expression to find the sum of cube root of x and the absolute value of y.
Give the output of the following program segment:
String S = "GRACIOUS".substring(4); System.out.println(S); System.out.println("GLAMOROUS".endsWith(S));Give the output of the following program segment and mention how many times the loop is executed.
int K = 1; do {K += 2; System.out.println(K); } while (K <= 6);