Question: undefined Assume that variable myNumber is declared and initialized. Which line(s) of the following code will create a syntax error? Explain each error briefly. int

undefined
Assume that variable myNumber is declared and initialized. Which line(s) of the following code will create a syntax error? Explain each error briefly. int myNumber = 21; switch (myNumber): { case (myNumber >= 0) System.out.print("myNumber is 21"); break; case 210 System.out.print("myNumber is 210"); break; case 44.0: System.out.print("myNumber is 44.0"); break; case 66: System.out.print("myNumber is 6"); break; case 100/2: System.out.print("myNumber is 50"); break; default: System.out.print("something else"); break; } Write a public method named calcSum that takes a a parameter named a of type int. If a is less than 1 the method returns - 1 otherwise it returns a number that is the result of applying the following formula to k values ranging from 1 to a: Note : E is the symbol for summation. a 2 a(a + 2)2 2. k = 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
