Computer Science, asked by nehaparveen15, 1 year ago

Hello mates....what is the use of keyword "import"??need ur help...​

Answers

Answered by Anonymous
1

import keyword helps us to include the inbuilt packages(classes), and from other sources

Answered by siddhartharao77
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