fork download
  1. /*Gwendolyn Buchanan
  2. *2-9-12
  3. *This program is the first that will have user input. Kind of a prologue
  4. *of the text-based RPG I plan on making.*/
  5.  
  6. import java.util.*;
  7.  
  8. public class turnLeftOrRight
  9. {
  10. //initialize the keyboard
  11. Scanner reader = new Scanner (System.in)
  12.  
  13. //create two new variables
  14. String turn = new String;
  15. String consequence = new String;
  16.  
  17. public static void main (String [] args)
  18. {
  19. //ask user for input
  20. System.out.println("You are in a dungeon at a fork in th );
  21. System.out.println(" tunnel. One way slopes down; the);
  22. System.out.println(" other leads up. You have only one );
  23. System.out.println("torch left and no food; you need to );
  24. System.out.println("escape before it is too late. Which );
  25. System.out.println("way do you choose?");
  26.  
  27. reader.nextString;
  28.  
  29. if turn = "left"
  30. {
  31. System.out.println("Sorry. That was the wrong );
  32. System.out.println("choice. You died.");
  33. }
  34. if turn = "right"
  35. {
  36. System.out.println("Sorry. That way was wrong. );
  37. System.out.println("Now you are dead.");
  38. }
  39. }
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:11: ';' expected
	Scanner reader = new Scanner (System.in)
	                                        ^
Main.java:14: '(' or '[' expected
	String turn = new String;
	                        ^
Main.java:15: '(' or '[' expected
	String consequence = new String;
	                               ^
Main.java:20: unclosed string literal
		System.out.println("You are in a dungeon at a fork in th );
		                   ^
Main.java:20: ';' expected
		System.out.println("You are in a dungeon at a fork in th );
		                                                           ^
Main.java:21: illegal start of expression
		System.out.println(" tunnel.  One way slopes down; the);
		      ^
Main.java:21: ';' expected
		System.out.println(" tunnel.  One way slopes down; the);
		          ^
Main.java:21: unclosed string literal
		System.out.println(" tunnel.  One way slopes down; the);
		                   ^
Main.java:21: ';' expected
		System.out.println(" tunnel.  One way slopes down; the);
		                                                        ^
Main.java:22: illegal start of expression
		System.out.println(" other leads up.  You have only one );
		      ^
Main.java:22: ';' expected
		System.out.println(" other leads up.  You have only one );
		          ^
Main.java:22: unclosed string literal
		System.out.println(" other leads up.  You have only one );
		                   ^
Main.java:22: ';' expected
		System.out.println(" other leads up.  You have only one );
		                                                          ^
Main.java:23: illegal start of expression
		System.out.println("torch left and no food; you need to );
		      ^
Main.java:23: ';' expected
		System.out.println("torch left and no food; you need to );
		          ^
Main.java:23: unclosed string literal
		System.out.println("torch left and no food; you need to );
		                   ^
Main.java:23: ';' expected
		System.out.println("torch left and no food; you need to );
		                                                          ^
Main.java:24: illegal start of expression
		System.out.println("escape before it is too late.  Which );
		      ^
Main.java:24: ';' expected
		System.out.println("escape before it is too late.  Which );
		          ^
Main.java:24: unclosed string literal
		System.out.println("escape before it is too late.  Which );
		                   ^
Main.java:24: ';' expected
		System.out.println("escape before it is too late.  Which );
		                                                           ^
Main.java:25: illegal start of expression
		System.out.println("way do you choose?");
		      ^
Main.java:25: ';' expected
		System.out.println("way do you choose?");
		          ^
Main.java:27: not a statement
		reader.nextString;
		      ^
Main.java:29: '(' expected
		if turn = "left"
		  ^
Main.java:29: ')' expected
		if turn = "left"
		                ^
Main.java:31: unclosed string literal
			System.out.println("Sorry.  That was the wrong );
			                   ^
Main.java:31: ';' expected
			System.out.println("Sorry.  That was the wrong );
			                                                 ^
Main.java:32: illegal start of expression
			System.out.println("choice.  You died.");
			      ^
Main.java:32: ';' expected
			System.out.println("choice.  You died.");
			          ^
Main.java:34: '(' expected
		if turn = "right"
		  ^
Main.java:34: ')' expected
		if turn = "right"
		                 ^
Main.java:36: unclosed string literal
			System.out.println("Sorry.  That way was wrong.  );
			                   ^
Main.java:36: ';' expected
			System.out.println("Sorry.  That way was wrong.  );
			                                                   ^
Main.java:37: illegal start of expression
			System.out.println("Now you are dead.");
			      ^
Main.java:37: ';' expected
			System.out.println("Now you are dead.");
			          ^
36 errors
stdout
Standard output is empty