Object class example in java

/* Object is a super class of all classes in Java*/


public class MyObject extends Object
{
    public static void main(String[] args)
    {
        // Create a new instance of MyObject.
        MyObject obj = new MyObject();

        // Get the hash code associated with MyObject.
        int hash = obj.hashCode();

        // Print out the hash code for obj.
        System.out.println("The hash code for obj is " +
            hash);
    }
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|