Results 1 to 4 of 4
  1. #1
    venkatv is offline Member
    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0

    Default Creating object of Type Object class

    Hi all

    Can anybody tell me the usage of the reference object give below in a snnipet

    Object obj = new Object();

    My question is
    what is the usage of object created of Type Object class?



    Regards
    venkat

  2. #2
    cecily is offline Member
    Join Date
    Jul 2007
    Posts
    33
    Rep Power
    0

    Default

    The standard class Object is a superclass of all other classes.

    -A variable of type Object can hold a reference to any object, whether it is an instance of a class or an array.
    -All class and array types inherit the methods of class Object.
    -The methods of Object are as follows:
    o The method getClass returns the Class object that represents the class of the object. A Class object exists for each reference type. It can be used, for example, to discover the fully qualified name of a class, its members, its immediate superclass, and any interfaces that it implements.
    o The method toString returns a String representation of the object.
    o The methods equals and hashCode are declared for the benefit of hashtables such as java.util.Hashtable. The method equals defines a notion of object equality, which is bosed on value, not reference, comparison.
    o The method clone is used to make a duplicate of an object.
    o The methods wait, notify and notifyAll are used in concurrent programming using threads.
    o The method finalize is run just before an object is destroyed.

  3. #3
    venkatv is offline Member
    Join Date
    Jul 2007
    Posts
    4
    Rep Power
    0

    Default

    Thx for ur view
    My question is with the obj reference what is the use?

  4. #4
    cecily is offline Member
    Join Date
    Jul 2007
    Posts
    33
    Rep Power
    0

    Default

    it's a generic object class
    and the use depends on what do you want to do.
    for example

    Java Code:
    Object[][] data = new Object[6][2]

Similar Threads

  1. Creating a Comparable object
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-15-2008, 07:38 PM
  2. List views, a type of object
    By Leprechaun in forum New To Java
    Replies: 2
    Last Post: 02-06-2008, 03:07 AM
  3. Need help with creating array of type object
    By riz618 in forum New To Java
    Replies: 3
    Last Post: 01-29-2008, 06:14 AM
  4. Getting object type
    By gapper in forum New To Java
    Replies: 1
    Last Post: 01-20-2008, 08:49 AM
  5. How to cast an Object into a specific type (Integer/String) at runtime
    By mailtogagan@gmail.com in forum Advanced Java
    Replies: 2
    Last Post: 12-03-2007, 01:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •