Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

java question need answer in 15 mins 15) would be the result of attempting to co

ID: 3772185 • Letter: J

Question




java question need answer in 15 mins

15) would be the result of attempting to compile and run the following code? What public class Test public static void main(Stringl l args) doublel 1 x new double 1, 2, 3 System out, println( value is x 1D; A) The Program compiles and runs fine and the ou value is 2.0" is printed. B) The program has a compile error because the new doublel wrong and it should be replaced by new double 2, O The program has a compile error because the syntax new double[ 111,2,3 is wrong and it should be replaced by 11, 2, 31. D) The program compiles and runs fine and the output "value is 1.0" is printed. E) The program has a compile error because the syntax new double 1, 2, 3l is wrong and it should be replaced by new double 1.0, 2.0, 3.0 16) How many elements are in array doublei llist new double15l? 16) A) 5 D) B) 0 17) Analyze the following code public class Test1 public static void main (String[ args) l xMethod(new double j13, 3); xMethod(new double 5); xMethod(new double13111, 2, 3)) public static void xMethod(doublel la) System out println(a length); A) The program has a compile error because xMethod(new doublel 13,3) is incorrect. The program has a runtime error because a is null. becausexMethod(new doubleialli, 2.3 is incorrect. D) The program has a compile error 18) suppose TestCircle and Circle in Listing 7.1 in the textbook are in two separate files named Test Circle a and Circle java, respectively. What is the outcome of compiling TestCircle. ava and then Circle java? B) Neither compiles successfully. A) Only Circle java compiles D) Both compile fine

Explanation / Answer

15)
B)

16)
A) 5

17)
D)

18)
D)

19)
A)

20)
B)

21)
B)

22)
A)