Solved

Write a Switch Statement That Switches on an Integer Variable

Question 7

Essay

Write a switch statement that switches on an integer variable named val. If val is 2 or 15, then output "Hello World." For all other values, output "Goodbye World."

Correct Answer:

verifed

Verified

switch(val) {
case 2:
System.o...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions