Computer Applications
Rewrite the following code using the if-else statement:
int m = 400;
double ch = (m>300) ? (m / 10.0) * 2 : (m / 20.0) - 2;
Related Questions
Convert the following do…while loop to for loop:
int x = 10; do { x––; System.out.print(x); }while (x>=1);Give the output of the following Character class methods:
(a) Character.toUpperCase ('a')
(b) Character.isLetterOrDigit('#')
Give the output of the following program segment:
int n = 4279; int d; while(n > 0) { d = n % 10; System.out.println(d); n = n / 100; }Give the output of the following String class methods:
(a) "COMMENCEMENT".lastIndexOf('M')
(b) "devote".compareTo("DEVOTE")