Java syntax: Difference between revisions

Content deleted Content added
Universal types: Fixed formatting
Line 253:
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:
 
====java.lang.Object====
;{{code|java.lang.Object:}} is Java's [[top type]]. Superclass of all classes that do not declare a parent class. All values can be converted to this type, although for primitive values this involves [[Object type (object-oriented programming)#Autoboxing|autoboxing]].
;java.lang.String: Java's basic string type. [[immutable object|Immutable]]. Some methods treat each [[UTF-16]] code unit as a "character", but methods to convert to an <code>int[]</code> that is effectively [[UTF-32]] are also available.
 
;java.lang.Throwable: supertype of everything that can be [[exception handling|thrown or caught]] with Java's <code>throw</code> and <code>catch</code> statements.
====java.lang.String====
;{{code|java.lang.String:}} is Java's basic string type. [[immutable object|Immutable]]. Some methods treat each [[UTF-16]] code unit as a "character", but methods to convert to an <code>int[]</code> that is effectively [[UTF-32]] are also available.
 
====java.lang.Throwable====
;{{code|java.lang.Throwable:}} is supertype of everything that can be [[exception handling|thrown or caught]] with Java's <code>throw</code> and <code>catch</code> statements.
 
==Program structure==