dimanche 20 novembre 2016

I am new to java and i do not know what i am doing wrong with my if statement [duplicate]

This question already has an answer here:

I am new to programming in java and i do not know what i am doing wrong with my if statements. Eclipse is saying that there are two errors and i do not know what to do.

package adventure;

import java.util.Scanner;
import javax.awt.swing.*;
import java.awt.FlowLayout;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Text {

public static void main(String[] args) {
    System.out.println("Welcome to AmazingELF74's Text Based Adventure: Castlevania XIV");      //Title

    Scanner modeSelect1 = new Scanner(System.in);       //Input For Game Mode
    System.out.println("Please Type Mode");     //Asks For Game Mode Select
    System.out.println("EASY(1)   MEDIUM(2)   HARD(3)");        //Tells About Game Modes
    int modeSelect = modeSelect1.nextInt();                         //^

    System.out.println("Selected:");        //Confirms Game Mode Select
    System.out.println(modeSelect);                 //^

    //Finds And Selects Adventure To Run
    //Entire Adventure Goes In Respective If Statements
    if (modeSelect == 1)
    {
    System.out.println("You are a poor farmer, who lives in the Kingdom Of Galigom");       //Adventure 1
    System.out.println("A band of mountain trolls threatens your village");
    System.out.println("Because your village is lazy, YOU must rise to defeat them");
    System.out.println("But all that you have is the sword used by your father, Behr Grylls, Used in the Great Ogar Wars");
    System.out.println("You must decide whether to use the Sword(1), or use the Club Of Mace(2) that has sat in your toilett for over ten scores");
    Scanner weaponSelect = new Scanner(System.in);
    int weaponSelect1 = weaponSelect.nextInt();
            //Select weapon to use
            if (weaponSelect == 1)
            {
                    System.out.println("You Chose Sword");
                    else if (weaponSelect == 2)
                    {
                        System.out.println("You Chose Club Of Mace");
                    }
            }
    }
        else if (modeSelect == 2)
        {
            System.out.println("Message Here");     //Adventure 2
                {
                if (modeSelect == 3)
                {
                    System.out.println("Message Here");     //Adventure 3
                    }   
                {

                }
        }
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire