Are Java Primitive Variables Objects?

  • 124 views
Uploaded on

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

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

~ Wasif Altaf

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
124
On Slideshare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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