-2

So I'm just doing some tests but for some reason a variable is not letting it be loaded... Here's my code:import java.util.Scanner;


import java.util.Scanner;

public class EquipmentTest {

    static String choice;


    public static void main(String[] args) {
        Scanner SCANNER = new Scanner(System.in);
        Scanner enterScanner = new Scanner(System.in);

        choice = SCANNER.toString();

        if(choice=="E") {
            int PLAYERINFO.HEADEQ "{--error here" = ARMOR.SILKHAT;
        }

        System.out.println(PLAYERINFO.HEADEQ);
    }

}

public class PLAYERINFO {

    //Player equipment

    public static int HEADEQ = 1;
    public static int CHESTEQ = 1;
    public static int LEGSEQ = 1;
    public static int FEETSEQ = 1;

    //Player defense calculation

    public static int DEFENSE = HEADEQ + CHESTEQ + LEGSEQ + FEETSEQ;

    //Player statistics

    public static int PLAYERHP = 10;
    public static int PLAYERDEFENSE = DEFENSE;
    public static int PLAYERSPEED = 7;
    public static int PLAYERATTACK = 6;
    public static int PLAYERMAGIC = 6;

}

public class ARMOR {

    public static int SILKHAT = 2;

}

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
  Syntax error on token ".", , expected

  at EquipmentTest.main(EquipmentTest.java:15)

I looked everywhere but I can't find my error. Any help is good!

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
  • 1
    `if(choice=="E")` ← Expect this to fail eventually. See https://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java. – VGR Jan 14 '20 at 21:14

1 Answers1

2

Change

int PLAYERINFO.HEADEQ = ARMOR.SILKHAT;

to

PLAYERINFO.HEADEQ = ARMOR.SILKHAT;
ardenit
  • 3,610
  • 8
  • 16