what is the use of keyword new
Answers
Explanation:
The Java new keyword is used to create an instance of the class. In other words, it instantiates a class by allocating memory for a new object and returning a reference to that memory. We can also use the new keyword to create the array object.
Answer:
Short notes on import statement:
In Java, Import statement is used for referring either all the classes & interfaces of the specific package (or) a specifying about particular class/interface of a specific package in our java program.
Syntax:
(i) import package1.package2.....*;
It is used to import all the predefined properties of specific package.
(ii) import package1.package2....classname/interfacename;
It refers either one class (or) one interface of a specific package but not all.
Advantages of 'import':
•••(i) Easier to provide access control.
•••(ii) Name conflicts i.e Name space collision is avoided.
•••(iii) Reusability.