Primitive classes
In this section, I'd like to take a very quick look at the primitive classes available to us in Java. In Java, we often say that strings are special because they have a literal interpretation identified by these double quotation marks; however, we still interact with them primarily through the String
class, rather than a string
primitive type that is not actually available to us.
In the case of a standard Java primitive, however, we generally interact with it through its primitive typing method. For every primitive type, we do have a corresponding primitive class. These are the Integer
, Character
, and Float
classes and so on. For the most part, the explicit uses of these classes where we create an instance of them and then call methods on that instance are not very useful unless we're overriding them to create a class of our own. Let's look at the following program:
package the.primitiveclasses; public class ThePrimitiveClasses { public static void main(String[...