Java – Access variable from a different class in a different package

game-physicsjavanetbeans

I want to set it so igAS for each igCharacter will be limited by a variable in igMech.
Here is what I have
first :

    package igCharacters;
    import igMech.*;
    protected class igBrand {
            public double igAS = .77;
    }

second:

    package igMech;
    class igLimits {
            double aSLimit = 2.5
    }

Best Solution

I think you might want to use the public modifier (although it's quite hard to tell what you mean from your question). You are using default, which is package-private (i.e. not accessible from any class outside the package igMech). Using public means a class is visible from any package.

package igCharacters;
import igMech.*;
protected class igBrand {
  public double igAS = .77;
}

package igMech;
public class igLimits { // now visible from the igCharacters package
  public double aSLimit = 2.5
}