What is instance variable in Java?

Instance variable (or a field) is a variable, that belongs to an instance of a class.

They are declared inside classes like so:

public class Person {
  public String name;
}

This allows you to set a different name for every instance of a Person:

Person jim = new Person();
jim.name = "Jim";

Person sally = new Person();
sally.name = "Sally";

System.out.println(jim.name); // Jim
System.out.println(sally.name); // Sally

So instances are like boxes, that hold instance variables. Every box has its own set of variables, and this set travels together with the respective box.