answersLogoWhite

0

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

12y ago

What else can I help you with?

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.


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 is the use of keyword new used in AWT programming?

what is the use of new keyword in awt programming


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


Can I use your keyword in my question?

Yes, you can use the keyword in your question.


Can you provide a spelling review for the keyword "accommodation"?

The correct spelling for the keyword "accommodation" is A-C-C-O-M-M-O-D-A-T-I-O-N.


Is it okay to use the keyword in this context?

Yes, it is appropriate to use the keyword in this context.


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 is the use of keyword new used in AWT programming?

what is the use of new keyword in awt programming


What are the music sheet letters for the keyword "melody"?

The music sheet letters for the keyword "melody" are: E, D, O, L, Y.


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.


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

Delete keyword


Sure! What is the alphabetical order of the letters in the keyword?

The alphabetical order of the letters in the keyword is: a, b, d, e, h, k, o, r, w.


Can I use the keyword in an argumentative essay?

Yes, you can use the keyword in an argumentative essay as long as it is relevant to the topic and supports your argument effectively.