Instance variable is the variable declared inside a class, but outside a method: something like:
class IronMan{
/** These are all instance variables **/
public String realName;
public String[] superPowers;
public int age;
/** Getters / setters here **/
}
Now this IronMan Class can be instantiated in other class to use these variables, something like:
class Avengers{
public static void main(String[] a){
IronMan ironman = new IronMan();
ironman.realName = "Tony Stark";
// or
ironman.setAge(30);
}
}
This is how we use the instance variables. Shameless plug: Example pulled from this free ebook here here.