are java primitive variables objects?
DESCRIPTION
A presentation which finds out the difference between Java primitive variables and Java objects. ~ Wasif AltafTRANSCRIPT
Yes Or
NO!
Java Language Specifications
:: DEFINITIONS ::
4.12 Variables: A variable is a storage location and has an associated type, sometimes called its compile-time type, that is either a primitive type (§4.2) or a reference type (§4.3).
:: DEFINITIONS ::
4.12.1 Variables of Primitive Type: A variable of a primitive type always holds a value of that exact primitive type.
:: DEFINITIONS ::
4.12.2 Variables of Reference Type: A variable of a class type T can hold a null reference or a reference to an instanceof class T or of any class that is a subclass of T.
NO!Are Variables Objects?
Type Wrapper Classes
Byte Integer
Double
Character
Float
Long
AutoBoxing
Boxing
UnboxingbooleanValue( )
intValue( )charValue( )
valueOf( type arg )
Integer x , y ; x = 12 ; y = 15 ; System.out.println( x + y );
:: EXAMPLE ::
NO!NO!
NO!
Are Variables Objects?
http://java.sun.com/docs/books/jls/download/langspec-3.0.pdf
http://www.javaranch.com/campfire/StoryCups.jsp
http://www.javaranch.com/campfire/StoryPassBy.jsp
http://java.sun.com/docs/books/tutorial/java/data/numberclasses.html
http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html
http://forums.sun.com/thread.jspa?threadID=5387311
:: REFERENCES ::
Discussion
Thanks