I am trying to design an airline reservation system. The code should be self-explanatory. The generateRandom methods output a random number. However, after the first while-loop executes, the program stops running, which means the loop is infinite and the compiler never reaches the next line of code. Why?
import java.util.*; public class Main {
public static void main(String[] args) {
    
    
    //initialization of passenger LL
    LinkedList<Passenger> PassLL = new LinkedList<Passenger>();       
 
    Scanner input2 = new Scanner(System.in);
    System.out.println("Please enter your preferred class.");
    String clasz = input2.nextLine();
    
    while(true) {
        clasz = input2.nextLine();
        if(clasz == "Economy" && generateRandom.erand < 30) {       
            break;}
        if(clasz == "Business" && generateRandom.erand < 18) {      
            break;}
        if(clasz == "First" && generateRandom.erand < 8) {      
            break;}
        if(clasz == "Economy" && generateRandom.erand == 30) {
            System.out.println("I'm sorry, economy is full. Please choose another class.");}
        if(clasz == "Business" && generateRandom.brand < 18) {
            System.out.println("I'm sorry, business is full. Please choose another class.");}
        if(clasz == "First" && generateRandom.frand < 8) {
            System.out.println("I'm sorry, first is full. Please choose another class.");}
        }
    
    
    Scanner input6 = new Scanner(System.in);
    System.out.println("How many tickets would you like to book?");
    int tickets = input6.nextInt();
  
  
}
}
