This lesson will
take a closer look at defining and using static and non-static variables and
following fundamental information that supports understanding Java Static
object is an instance of a class.
create an instance of a typical class you can do the following:
myinstance = new Classname();
myStringinstance = new String("Hello, World");
3. In many
cases, you can "instantiate" many instances of a class.
String myStringinstance1 = new String("Welcome");
String myStringinstance2 = new String("To the Java course");
String myStringinstance3 = new String("Your instructor is Dr. Franklin
each class definition, variables and methods can be defined. Each of these can
one or more
modifiers associated with them. Examples of modifiers include
and many others.
As you read more
about this topic in this lesson and other literature, keep in mind the
(and methods) are often referred to as class variables (and methods)
non-static variables (and methods) are often referred to as instance variables
by default, a
variable or method is non-static.