Creating an Object Instance in Java

Creating an Object Instance in Java

Previous Home Next

 

To create an instance of the object we use the "new" keyword

On the left hand side of the equals sign is the object declaration. It's saying I want to make a object and call it by other name.
 On the right hand side of the equals sign is the creation of a new instance of a  object
 


 
		
public class Book
{

public static void main(String[] args)
{

Book firstBook = new Book("fairy tail","Dr. Seuss","Random House");

firstBook.displayBookData();
}
}

Previous Home Next