Content deleted Content added
No edit summary Tags: Mobile edit Mobile web edit |
Tags: Mobile edit Mobile web edit |
||
Line 278:
Classes in the package java.lang are implicitly imported into every program, as long as no explicitly-imported types have the same names. Important ones include:
===={{mono|java.lang.Object}}====
{{code|java.lang.Object}} is Java's [[top type]]. It is implicitly the superclass of all classes that do not declare any parent class (thus all classes in Java inherent from <code>Object</code>. All values can be converted to this type, although for primitive values this involves [[Object type (object-oriented programming)#Autoboxing|autoboxing]].
===={{mono|java.lang.Record}}====
All [[Record (computer science)|records]] implicitly extend {{code|java.lang.Record}}.
===={{mono|java.lang.Enum}}====
All [[enumerated type]]s (enums) in Java implicitly extend {{code|java.lang.Enum}}. Thus, an <code>enum</code>, while treated as a <code>class</code>, cannot extend any other class.
====java.lang.String====
{{code|java.lang.String}} is Java's basic string type. It is [[immutable object|Immutable]]. It does not implement {{code|Iterable<Character>}}, so it cannot be iterated over in a for-each loop, but can be converted to <code>char[]</code>. Some methods treat each [[UTF-16]] code unit as a
====java.lang.Throwable====
|