answersLogoWhite

0


Best Answer

When we want to use classes of packages other than the default package and java.lang, we should import them.

Example :

import java.util.Scanner;

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the use o keyword import?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Name the following-A key word to use the classes defined in a package?

To access the classes which are present in other packages, we have to import the package to our program using the keyword 'import'. Eg: import packagename.subpackage.Class; OR import packagename.subpackage.*; /*Adds all the class which are present in package*/ 'extends' is the keyword used to inherit the classes defined in other packages.


What is the use of keyword new used in AWT programming?

what is the use of new keyword in awt programming


Why to use 'import' in java?

The import statement in Java allows to refer to classes which are declared in other packages to be accessed without referring to the full package name. You do not need any import statement if you are willing to always refer to java.util.List by its full name, and so on for all other classes. But if you want to refer to it as List, you need to import it, so that the compiler knows which List you are referring to. Classes from the java.lang package are automatically imported, so you do not need to explicitly do this, to refer to String, for example.


What are the 6 ways to use this keyword?

"Java This keyword" is a reference to the current object, it is very helpful when you need to refer an instance of a particular Object from its available methods or using it's constructor, also "this" keyword helps us to avoid naming conflicts.The following are different ways to use java this keyword1) Using with instance variable2) Using with Constructor3) Pass / Return current instanceUsing with instance variableUsing this keyword inside a method or constructor it will use instance variable instead of local variable, in the absence of this keyword it will use local variableUsing with instance variableUsing this keyword inside a method or constructor it will use instance variable instead of local variable, in the absence of this keyword it will use local variableUsing with ConstructorUsing this keyword inside constructor like followingthis("Sony", 20); it will call the constructor having same parameter


Is super keyword is analogous to this keyword in java?

No. The keyword super is used to refer to the parent class instance while the keyword this is used to refer to the current class instance. You need to learn about Inheritance and Object creation using constructors to learn more about these keywords and their use

Related questions

Name the following-A key word to use the classes defined in a package?

To access the classes which are present in other packages, we have to import the package to our program using the keyword 'import'. Eg: import packagename.subpackage.Class; OR import packagename.subpackage.*; /*Adds all the class which are present in package*/ 'extends' is the keyword used to inherit the classes defined in other packages.


Can an identifier be used as a keyword?

As is used to import Module name as short short cut... EX: import math as m ........Husnu


What is the use of keyword new used in AWT programming?

what is the use of new keyword in awt programming


Why to use 'import' in java?

The import statement in Java allows to refer to classes which are declared in other packages to be accessed without referring to the full package name. You do not need any import statement if you are willing to always refer to java.util.List by its full name, and so on for all other classes. But if you want to refer to it as List, you need to import it, so that the compiler knows which List you are referring to. Classes from the java.lang package are automatically imported, so you do not need to explicitly do this, to refer to String, for example.


Which keyword do you use to deallocate memory that has been assigned to a stream object?

Delete keyword


Explanation of import javautilDate?

The import keyword in Java is used to tell the Java compiler where to find different classes and packages.java.util.Date is the location of the Date class: Date is a member of the util package, which is a member of the java package.


Can you declears static in a local variable in a method in java?

we cannot use the staic keyword inside the method... But we can use the final keyword inside the method....


Is it possible to create a static object in main?

Yes, anywhere that you can normally declare an object you can use the static keyword to make that object static.int main (){static Object o;}


How can you get regi rock o n Pokemon perl?

you have to import it from emerald,ruby or Sapphire you have to import it from emerald,ruby or Sapphire


What are the 6 ways to use this keyword?

"Java This keyword" is a reference to the current object, it is very helpful when you need to refer an instance of a particular Object from its available methods or using it's constructor, also "this" keyword helps us to avoid naming conflicts.The following are different ways to use java this keyword1) Using with instance variable2) Using with Constructor3) Pass / Return current instanceUsing with instance variableUsing this keyword inside a method or constructor it will use instance variable instead of local variable, in the absence of this keyword it will use local variableUsing with instance variableUsing this keyword inside a method or constructor it will use instance variable instead of local variable, in the absence of this keyword it will use local variableUsing with ConstructorUsing this keyword inside constructor like followingthis("Sony", 20); it will call the constructor having same parameter


How many keywords you can use for link building?

You can use many keyword for link building, but you should use an LSI keyword so, you will better to give links on your keyword. The idea is to find as many qualifiers as possible that fit your audience. http://socialseoteam.com/link-building-2015.php


Is super keyword is anologous to this keyword in java?

No. The keyword super is used to refer to the parent class instance while the keyword this is used to refer to the current class instance. You need to learn about Inheritance and Object creation using constructors to learn more about these keywords and their use