Yes Or

NO!
Java Language

Specifications
:: DEFINITIONS ::
4.12 Variables: A variable is a storage
location and has an associated type,
sometimes called its compil...
:: DEFINITIONS ::
4.12.1 Variables of Primitive Type: A
variable of a primitive type always holds a
value of that exact pr...
:: DEFINITIONS ::
4.12.2 Variables of Reference Type: A
variable of a class type T can hold a null
reference or a referenc...
Are

Variables

Objects?

NO!
Byte
Float

Integer

Type Wrapper Classes
Long
Character

Double
Boxing

valueOf( type arg )

AutoBoxing
intValue( )

charValue( )
booleanValue( )

Unboxing
:: EXAMPLE ::
Integer x , y ;
x = 12 ;
y = 15 ;
System.out.println( x + y );
Are

Variables

Objects?

NO!

NO!

NO!
:: REFERENCES ::
http://java.sun.com/docs/books/jls/download/langspec-3.0.pdf
http://www.javaranch.com/campfire/StoryCups....
Discussion
Thanks
Are Java Primitive Variables Objects?
Are Java Primitive Variables Objects?
Upcoming SlideShare
Loading in …5
×

Are Java Primitive Variables Objects?

265 views
223 views

Published on

A presentation which finds out the difference between Java primitive variables and Java objects.

~ Wasif Altaf

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
265
On SlideShare
0
From Embeds
0
Number of Embeds
80
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Are Java Primitive Variables Objects?

  1. 1. Yes Or NO!
  2. 2. Java Language Specifications
  3. 3. :: 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).
  4. 4. :: DEFINITIONS :: 4.12.1 Variables of Primitive Type: A variable of a primitive type always holds a value of that exact primitive type.
  5. 5. :: 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 instance of class T or of any class that is a subclass of T.
  6. 6. Are Variables Objects? NO!
  7. 7. Byte Float Integer Type Wrapper Classes Long Character Double
  8. 8. Boxing valueOf( type arg ) AutoBoxing intValue( ) charValue( ) booleanValue( ) Unboxing
  9. 9. :: EXAMPLE :: Integer x , y ; x = 12 ; y = 15 ; System.out.println( x + y );
  10. 10. Are Variables Objects? NO! NO! NO!
  11. 11. :: REFERENCES :: 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
  12. 12. Discussion
  13. 13. Thanks

×