I am running the following code on Eclipse with no errors. When I am trying to do the same with Pico compiler app on my Ipad I get 4 types of errors. The print screen are attached. Any idea why cannot running in the same way?
The code:
"''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
import java.util.Scanner;
public class switchClass {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Please enter a command: ");
String text = scanner.nextLine();
scanner.close();
switch(text) {
case "start":
System.out.println("Machine started");
break;
case "stop":
System.out.println("Machine stopped");
break;
default:
System.out.println("Command not recognized!");
}
}
}
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Pico Compiler for Ipad running the code :
Pico Compiler errors :