Object A runtime entity that has state and behaviour is known as an object. For example: chair, table, pen etc. It can be tengible or intengible (physical or logical). An object has three characterstics: state:represents the data of an object. behaviour:represents the behaviour of an object. identity:Object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user, but is used internally by the JVM to identify each object uniquely. For Example: Pen is an object. Its name is Reynolds, color is white etc. known as its state. It is used to write, so writing is its behaviour. Object is an instance of a class.Class is a template or blueprint from which objects are created.So object is the instance(result) of a class. | 0 |
By: [email protected] On: Wed Jan 29 18:16:46 IST 2014 2 0 0 | 2 |
Are You Satisfied :1Yes1No |
The above answer which u gav is generalised one,I need with an example. My doubt is related to practicality not theoritical. | 0 |
By: [email protected] On: Wed Jan 29 18:22:58 IST 2014 0 0 0 | 0 |
Are You Satisfied :2Yes1No |
Objname = new <clsname () Clsname represents name of the treated as object. New is called dynamic memory allocation operator Clsname () represents constructor They are: i. It allocates sufficient amount of memory space for the ii. It takes an address of the Syntax-2 for defining an OBJECT: <Clsname> objname; //object declaration Objname = new <clsname ()>; // When an object is declared members of the class. When the memory space is created for the J2SE (Core JAVA) Notes : ()> class. Objname represents JAVA valid variable name operator. constructor. The new operator will perform two standard actions. data members class and stored in the left hand side variable of syntax : declaration// )>; object referencing// where value is null. Since, there is no memory space for object is referenced the value of the object data members of the class. Page 11 of the class. <Clsname> objname; //object declaration Objname = new <clsname ()>; // When an object is declared members of the class. When the memory space is created for the ()> class. Objname represents JAVA valid variable name operator. constructor. The new operator will perform two standard actions. data members class and stored in the left hand side variable of syntax : declaration// )>; object referencing// where value is null. Since, there is no memory space for object is referenced the value of the object data members of the class. Page 11 of the class. syntax-1. . data is not null. Since | 0 |
By: [email protected] On: Wed Jan 29 18:52:40 IST 2014 2 0 0 | 2 |
Are You Satisfied :1Yes1No |
thanks for the reply, but my question whether "s" is object or object reference and what's the difference? | 0 |
By: [email protected] On: Thu Jan 30 12:11:33 IST 2014 0 0 0 | 0 |
Are You Satisfied :1Yes0No |
s is the reference variable which refers to the object in the heap memory. The syntax: Sample s=new Sample(), here using new keyword is used to create a memory in the heap in which object is stored. "s" is the reference variable. It is stored in stack memory and from stack memory it refers to object in heap memory. | 1 |
By: [email protected] On: Thu Jan 30 16:00:56 IST 2014 0 359 0 | 359 |
Are You Satisfied :2Yes0No |