So, this may look like a mess but I just started Java a few hours ago and I was building a program I've had in my head for a while. Currently, it hangs up at the last section where it asks if there were any others in the video. Any idea why this is happening? Starts at bottom with variable yn.
import java.util.Scanner;
public class Tagger {
//inputs should include the type of video, who's in it, and what the game is called.
//Later versions can alter this, including alternate game titles.
public static void main(String[] args){
Scanner input = new Scanner(System.in);
String mod = null;
String who2 = null;
String group = "SmeggCo";
System.out.println("Welcome to the Actagger! Let's get started.");
System.out.println("To start, is this a mod spotlight or a Let's Play?");
String type = input.nextLine();
System.out.println("Awesome! A " + type + ", eh? Sounds fun!");
try {
Thread.sleep(3000);
}
catch (InterruptedException ex){
}
System.out.println("What game is it?");
String game = input.nextLine();
try {
Thread.sleep(3000);
}
catch (InterruptedException ex){
}
System.out.println( game + "? I'll have to check that out!");
if (type == "mod spotlight"){
System.out.println("What was the mod's name?");
mod = input.next();
System.out.println("Huh, I've never heard of" + mod + ".");
}
System.out.println("Alright, last question. Who was in this video?");
String who = input.next();
System.out.println(who + " is pretty awesome!");
try {
Thread.sleep(3000);
}
catch (InterruptedException ex){
}
System.out.println("Was anyone else in the vid?");
String yn = input.next();
if (yn == "Yes"){
System.out.println("Who?");
who2 = input.next();
System.out.println("So " + who + " and" + who2 + "? Those two are weirdos!");
String[] tags = new String[5]; //Setup final array of tags. Will add to this later in 2.0
tags[0] = type;
tags[1]=game;
tags[2]=who;
tags[3]=who2;
tags[4]=mod;
tags[5]=group;
System.out.println("Here's your tags!");
System.out.println(tags);
System.out.println("Does that look right? Good!");
}
if (yn == "No"){
String[] tags = new String[5]; //Setup final array of tags. Will add to this later in 2.0
tags[0] = type;
tags[1]=game;
tags[2]=who;
tags[3]=who2;
tags[4]=mod;
tags[5]=group;
System.out.println("Here's your tags!");
System.out.println(tags);
System.out.println("Does that look right? Good!");
}
}
}