/* 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);
}
}
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