Hi!
So Im in the process of learning Java. I’ve made some very simple programs in jGrasp but I have no idea how to actually save it as a launchable program and see it in action. Please help!
import java.util.Scanner;
public class Project1
{
public static void main (String [] args)
{
Scanner in = new
Scanner (System.in);
String action = ("");
System.out.println("What would you like to do?");
in.nextLine();
if (action.equals("Tell me Im pretty"))
{
System.out.println("You're gorgeous!");
System.exit(0);
}
else if (action.equals("Read me my file"));
{
System.out.println("You're over 40, work long hours and you regret giving birth to your kids.");
in.nextLine();
System.out.println("I'm so sorry, that was your mothers file!");
System.out.println("It seems like I've accidentaly erased your file, can we fill it out again?");
String answer1 = ("");
answer1 = in.nextLine();
if (answer1.equals("Sure"))
{
System.out.println("Okay! How old are you?");
}
else if (answer1.equals("Yes"));
{
System.out.println("Okay! How old are you?");
}
int age =(0);
age = in.nextInt();
System.out.println("Alright, so youre " + age);
}
}
}