Showing posts with label object. Show all posts
Showing posts with label object. Show all posts

Monday, October 10, 2011

What happens If the argument you want to pass Is an object Instead of II primitive?

You'll learn more about this In later chapters,but you already know the answer.Java passes
everything by value. EverythIng. But...value means bits Inside the vcrtable. And remem ber,you don't
stuff objects Into variables; the variable Is a remote control-a reference to an object. SoIf you pass a
reference to an object into a method, you're passing a copy of the remote control.

Identify who am I ?

I am compiled from a .java file.   : class
My instance variable values can be different from my buddy’s values. : object
I behave like a template. : class
I like to do stuff. : object, method
I can have many methods. : class,object
I represent ‘state’. : instance variable
I have behaviors. : object,class
I am located in objects. : method, instance variable
I live on the heap.  : object
I am used to create object instances. : class
My state can change.: object,instance variable
I declare methods. : class
I can change at runtime. : object, instance variable

What’s the difference between a class and an object?

A class is blueprint for an object .It tell VM how to make an object of that perticular type.
Each object made from that class can have its own values for the instance variables of that class.