Let’s say you had a TV class to deal with television sales. There are two kinds of variables:
Similarly, there are static methods about televisions in general and instance methods about particular televisions. Unless you have a TV object, you can’t call any of the instance methods. You don’t need a TV object to call one of the TV static methods. static methods may only look at the static fields. Instance methods may look at either the static or instance fields.
There can be only one public class in each source file. If your class was called HelloWorld the name of the source file must be precisely HelloWorld.java with every letter exactly matching even in case. In Java, there is no such thing as a method or variable that does not belong to some class. Java comes with a built-in set of classes arranged in a class hierarchy.
Class is also a class that will tell you various facts about a given class.
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.62] | The information on this page is for non-military use only. | ||
| You are visitor number 26,713. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror) | ||
| http://mindprod.com/jgloss/class.html | J:\mindprod\jgloss\class.html | ||