Hello mates....what is the use of keyword "import"??need ur help...
Answers
Answered by
1
import keyword helps us to include the inbuilt packages(classes), and from other sources
Answered by
2
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.
Hope this information helps!
Similar questions
Psychology,
7 months ago
English,
7 months ago
Math,
1 year ago
English,
1 year ago
Hindi,
1 year ago