0
import java.util.Scanner;
public class test {
    public static void main(String args[]) throws InterruptedException{
        Scanner Power=new Scanner (System.in);
        String Start;
        System.out.println("Would you like to start up the Smart Bottle?");
        Start = Power.nextLine();
        
        if (Start=="yes") {
        System.out.println("Starting Bottle...");
        Thread. sleep(500);
        System.out.println("Power switched on.");
        Thread. sleep(500);
        System.out.println("Starting all systems...");
        Thread. sleep(500);
        System.out.println("You look beautiful today...");
        Thread. sleep(500);
        System.out.println("Looking at the stars.");
        Thread. sleep(500);
        System.out.println("Thinking about how good today will be...");
        Thread. sleep(500);
        System.out.println("Welcome to Smart Bottle!");
    }
        
        if (Start=="no") {
            System.out.println("Systems Shutting Down.");
            Thread. sleep(500);
            System.out.println("Good night.");
        
    }
        
    }
}

What is wrong with my code?

It's not working in terms of that when I input "Yes" or "yes" it doesn't print out the things in my if statement.

shmosel
  • 49,289
  • 6
  • 73
  • 138

0 Answers0