Whats wrong with my Code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whats wrong with my Code?

PLZ Help (its Java) import java.util.Scanner; public class Program { public static void main(String[] args) { String menu = {"Tea", "Espresso", "Americano", "Water", "Hot Chocolate"}; Scanner sc = new Scanner(System.in); int choice = sc.nextInt(); if(choice < 0 || choice > 4){ System.out.print("Invalid"); } else { System.out.print(menu[choice]); } } }

20th Feb 2023, 10:10 PM
Tomato
Tomato - avatar
0 Answers