Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Application {
  4. public static void main(String[] args) {
  5.  
  6. Scanner input = new Scanner(System.in);
  7.  
  8.  
  9. System.out.println("Please enter a command: ");
  10. String text = input.nextLine();
  11.  
  12. switch(text) {
  13. case "start":
  14. System.out.println("Machine started!");
  15. break;
  16.  
  17. case "stop":
  18. System.out.println("Machine Stopped.");
  19. break;
  20.  
  21. default:
  22. System.out.println("command not recognised");
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement