I'm having trouble with some Java programming and I'm pretty confused on how the comparison operands work between inputs.
What I want is for my program to take input, analyze the input, check what it's equal to, and display a message based upon their input. How am I to compare the input, to the option1 variable I have set?
Here's one file, called loadfile.java
package subsets;
import java.io.*;
import java.util.Scanner;
public class loadfile {
        public static void main(String args[]) {
        }
        public static void choose(String[] args) {
            // Set an option
            int option1 = 1;
            // Start grabbing input
            System.out.print("Choose one: ");
            Scanner scanner = new Scanner( System.in );
            String input = scanner.nextLine();
            // Parse input into an integer (expecting int)
            int selection = Integer.parseInt(input);
            // If input == option1, let's go with this code.
            if(input.equals(option1)){
                System.out.println("You choose option 1.");
            }
        }
}
I have loadfile.choose(args); in a different file, and that file handles the rest of the files I will be implementing.
Here's the file: otherfile.java
package subsets;
public class otherfile {
        public static void main(String args[]){
            System.out.println("Please select an option (using number keys): \n");
            System.out.println(
                    "1. Option 1 \n"
                    + "2. Option 2 \n"
                    + "3. Option 3 \n"
                    + "4. option 4 \n");
            // Start analyzing their choice
            loadfile.choose(args);
        }
}
 
     
     
    