所以基本上,
//Black ops 2 Class generator Please help me FIX!!!!!!
import java.util.Scanner;
import java.util.Random;
public class money
{
public static void main(String[]args)
{
String primaryOption;
Scanner scan = new Scanner (System.in);
Random primaryGen = new Random();
String weaponType; //Rifle, SMG, HMG, Sniper, shotgun, or special
String primaryoption; //Do you want a primary?
String primaryWeapon; //The gun you get
int primaryWeapon1;
String primrayCamo; //Camo for primary
String MTAR = "MTAR", Type25 = "Type 25", SWAT556 = "SWAT-556", FALOSW = "FAL-OSW", M27 = "M27", SCARH = "SCAR-H", SMR = "SMR", M8A1 = "M8A1", AN94 = "AN-94";
String secondaryOption; //Do you want a secondary?
String secondaryWeapon; //Your gun
int secondaryWeapon1;
String secondaryCamo; //Camo for secondary
System.out.println("Would you like a Primary Weapon? Yes(1) or No(2)");
primaryOption = scan.nextLine();
if (primaryOption.equals("Yes")) {
System.out.println("Would you like a Rifle, SMG, HMG, Sniper, Shotgun, or Special?)");
weaponType = scan.nextLine();
if (weaponType.equals("Rifle")) {
primaryWeapon1 = primaryGen.nextInt(1) +1;
if (primaryWeapon1 == 1) {
primaryWeapon = MTAR; //*&%&*This is where i initialized it.
}
return;
}
System.out.println("Primary Weapon: " + primaryWeapon); //This is where the error is. It say's im not initializing the variable but I initialize it in the last if statement
}
}
}