This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I learned that the way to create objects in java is by using the "new" keyword... but i am confused when my professor told me that "Object dog = new Object()", he told that this is the way to do an instance of a class. What's the object here ... what's the instance of class here? Thank you.
"An object is an instance of a class" Consider another example
Student amit = new Student()
'Student' is the class 'amit' is a reference variable that points to a new instance of Student ie. 'amit' is an object of student.
In your example Object dog = new Object() In this case, our class is Object and object is dog. Note the difference between Object and object. Object is a real class in Java, superclass of all classes, top of hierarchy. Whereas 'object' with a small o refers to an instance of that class.