+ 2
What is the use of new keyword in java?
4 Respuestas
+ 2
Java is object oriented programming language.
Suppose you would like to design a 'dog' object.
You will have to create a Dog.java file which contains a 'public class Dog {}' This class is the object definition.
And to 'create' one dog instance using the definition, you will use 'new' keyword with for example the 'new Dog()' instruction.
Dog bobby = new Dog();
+ 4
"new" keyword is used to create an object of a class. Only after you use a new keyword, a memory block on the heap is allocated for that object.
+ 2
New key word will help to create object to class
+ 1
I think that going through the Java tutorial may help.