Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Reference type Vs Object type.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


naveen
Reference type Vs Object type.
2 Answer(s)      5 years and 11 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 17, 2008 at 6:04 PM


Hi friend,


Objects :

Objects are the basic unit of object orientation with behavior, identity.
These are part of a class but are not the same. An object is expressed by the variable and methods within the objects.
These variables and methods are distinguished from each other as instant variables, instant methods and
class variable and class methods.

* All objects are allocated on the heap.
* Objects consist of instance fields for the class of the object, plus instance fields for its superclasses.
* Every object is created by a class constructor. Interfaces don't have constructors.


Reference variables :

* All non-primitive variables contain only references to objects on the heap.
They never contain the object. C++ object variables may be either,
but Java supports only object references.

For Example :

Book bookvar = new Book("Java");


bookvar is not an object, it's a variable which contains a reference to an object.
Objects don't have names, just types and locations in memory (and, of course,
fields and methods).

Create a new Book object in memory.
Initialize it with the data sent as arguments to a constructor.
When created, assign a reference to that object to the Book variable bookvar.
"bookvar" is a reference or object type variable which may reference a Book object or
an object of any subclass of Book.


For more information on

http://www.roseindia.net/java/beginners/oop-in-java.shtml

http://www.roseindia.net/java/java-tips/oop/oop-summary.shtml


Thanks


March 25, 2010 at 10:15 PM


Long story short, for this below field declaration:

Employee mgr = new Manager(); // lets assume Manager is a subclass of Employee

Class 'Employee' would be the REFERENCE TYPE
and
Class 'Manager' would the OBJECT TYPE

Moderators, please correct me if I'm wrong.


Related Tutorials/Questions & Answers:
Reference type Vs Object type. - Java Beginners
Reference type Vs Object type.  Can anyone explain the exact difference between Reference and Object, how can i create a reference ? When exactly... or object type variable which may reference a Book object or an object of any
object retun type - Java Beginners
object retun type  Hi, i have to create a method which should have return type of object . The object should contain 'list of filenames' array and a boolean field 'isVal'. Can anybody help
Advertisements
Method is undefined for the type Object(org.apache.jasper.JasperException)
Method is undefined for the type Object(org.apache.jasper.JasperException)  [Tag:java] I am getting an Error, while accessing a JSP Page through my... getPracticeRevenueCode() is undefined for the type Object
Convert an Integer type object to a String object
Convert an Integer type object to a String object   ... the Integer type object to a String object using the Integer.toBinaryString...; Create a class "NumberFormats" where an integer type object is converted
type casting
List (object type) <Object> totalList(int pi){ try{ Query q...type casting  <--bean class-->method calllist is of object type...){ return null; } how to type cast object type to entity type
Object reference not set to an instance of an object
Object reference not set to an instance of an object  Object reference not set to an instance of an object
I retrieve a String or other object type without creating a new object each time.
I retrieve a String or other object type without creating a new object each time.  How can I retrieve a String or other object type without creating a new object each time
type casting
type casting  what is type casting
Type casting
Type casting  how to type cast a string value to byte array
PHP Object Type
PHP Object: Class, and Object are one of the most important feature of OOP. Object is the instance of a class, to create an object we use new keyword. In PHP we can convert any value to an object of a predefined class called stdClass
type mismatch
type mismatch  Statement s= con.createStatement(); this line gives error of "type mismatch" I am using eclips nd new to servlet nd JDBC, Please help me, Thank you
type casting
type casting  int n=20; n=sizeof((char)(float)n); what is n value
data type
data type  which data type is used to store video file in mysql databse
data type
Single Double Decimal Char Boolean Date String Object
Casting (Type Conversion)
casting. In java one object reference can be type cast into another object reference... reference to a reference variable of the type Object, as Object class comes at the top... Casting (Type Conversion)      
Java type casting
Java type casting  Can a Byte object be cast to a double value
Type casting in java
of casting; primitive type and reference type casting. Reference type casting is nothing but  casting one object type to another object type. In simple... a double type cast to int type    Reference type casting : In java type
PHP Type Hinting
a value into objects of a class or to an array. Type Hints only supports object... object of any class type or array type. Example : <?php class One...PHP Type Hinting Function: Type hinting is a special type of function which
Type Comparison Operator
an object to a specified class type. The instanceof operator is defined..., if the object or array is an instance of the specified type; otherwise it returns... the object of class "X" has the reference to the object of class "Z"
UIButton sender type cast
UIButton sender type cast  Hi, I want to type cast sender object... to typecast the sender object into UIButton. Please see the following code: UIButton... to typecast the sender object into UIButton. Please see the following code: UIButton
coding for re-type password
coding for re-type password  coding for re-type password
Document Type Definition
Document Type Definition  What is Document Type Definition
fastest type of JDBC driver
fastest type of JDBC driver  What is the fastest type of JDBC driver
PHP Object Reference
that the terms object and reference is interchangeable. Now we must know what is actually an object and what is a reference. Whenever an object is instantiated... we call the first reference of that memory chunk as object and the objects
Fastest type of JDBC Driver
Fastest type of JDBC Driver  hello, What is the fastest type of JDBC driver?   hii, Type 4 is the fastest JDBC driver
Java type casting
Java type casting  What is Downcasting
eraser type generics in java
eraser type generics in java  Explain eraser type generics in java with example
What is mime type in HTML
What is mime type in HTML  what is mime type in html? is it different in new HTML5
What is mime type in HTML
What is mime type in HTML  what is mime type in html? is it different in new HTML5
type casting purpose
type casting purpose  what is type casting , could u explain with practical example
Data type in java
. Primitive Data type Reference Data  type Primitive Data type... data type is used to store any character. Reference Data type : It is also called non-primitive or object type, which are used to access object type
 

 

 

DMCA.com