4.5.1
Variables of Primitive Type
TYPES, VALUES, AND VARIABLES
Compatibility of the value of a variable with its type is guaranteed by the
design of the Java language. Default values are compatible ( 4.5.4) and all assign 
ments to a variable are checked for assignment compatibility ( 5.2), usually at
compile time, but, in a single case involving arrays, a run time check is made
( 10.10).
4.5.1   Variables of Primitive Type
A variable of a primitive type always holds a value of that exact primitive type.
4.5.2   Variables of Reference Type
A variable of reference type can hold either of the following:
A null reference
A reference to any object ( 4.3) whose class ( 4.5.5) is assignment compati 
ble ( 5.2) with the type of the variable
4.5.3   Kinds of Variables
There are seven kinds of variables:
1. A
class variable
 is a field declared using the keyword
static
 within a class
declaration ( 8.3.1.1), or with or without the keyword
static
 within an inter 
face declaration ( 9.3). A class variable is created when its class or interface is
loaded ( 12.2) and is initialized to a default value ( 4.5.4). The class variable
effectively ceases to exist when its class or interface is unloaded ( 12.8), after
any necessary finalization of the class or interface ( 12.6) has been completed.
2. An
instance variable
 is a field declared within a class declaration without
using the keyword
static
 ( 8.3.1.1). If a class
T
 has a field
a
 that is an
instance variable, then a new instance variable
a
 is created and initialized to a
default value ( 4.5.4) as part of each newly created object of class
T
 or of any
class that is a subclass of
T
 ( 8.1.3). The instance variable effectively ceases
to exist when the object of which it is a field is no longer referenced, after any
necessary finalization of the object ( 12.6) has been completed.
3.
Array components
 are unnamed variables that are created and initialized to
default values ( 4.5.4) whenever a new object that is an array is created
( 15.9). The array components effectively cease to exist when the array is no
longer referenced. See  10 for a description of arrays.
44






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved