21. Assume you have the following array declaration: double [] daList = new double [5]; What is the valid range for the
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
21. Assume you have the following array declaration: double [] daList = new double [5]; What is the valid range for the
public static String secret(int nFirst, double dSecond) { String sTemp = ""; if (dsecond > nFirst) 2.0 else O 45 sTemp += nFirst dSecond; 24. What is the output of the following statement? System.out.println(secret (5, 9.0)); sTemp+= nFirst - dSecond; return sTemp; O 45.0 O 9.0 O Compile error-illegal method call 2 pts 2nts
public static String secret(int nFirst, double dSecond) String sTemp = ""; if (dSecond > nFirst) else sTemp += nFirst dSecond; sTemp += nFirst -dSecond; return sTemp; } 23. Which of the following is a legal method call? O String res- secret(10, 12): O double res- secret(10, 12.0): O String res- secret(10.0, 12.0): O double res secret(10, 12):
36. The following program outputs to the console. (Remember Java evaluations are from left to right in the order of precedence between members of the same type.) public static void main(String[] args) { int nQ1 = 84; int nQ2 = 83; double dAvg = 0.0; dAvg = (nQ1 + nQ2)/2; System.out.println("The average is: " + dAvg); } O compiler error The average is: 83 O The average is: 83.0 O The average is: 83.5 2 pts