Skip to content
Advertisement

Tag: instance-variables

What is an instance variable in Java?

My assignment is to make a program with an instance variable, a string, that should be input by the user. But I don’t even know what an instance variable is. What is an instance variable? How do I create one? What does it do? Answer Instance variable is the variable declared inside a class, but outside a method: something like:

Advertisement