Core Java - Interview Questions and Answers for 'Import statement' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Import statement' - 4 question(s) found - Order By Rating

 Q1. Which java package is loaded by default and hence doesn't require an explicit import statement ?Core Java
Ans. java.lang

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java.lang  import statement      basic


 Q2. What is the problem we could face if we be very liberal with importing classes even if we are not using them ? For example

import java.util.*;
import java.io.*;
Core Java
Ans. It makes application little heavy as we are importing classes that aren't required.

It creates class name conflicts as similar name classes might be available across different packages. In case of such conflicts, we will have to specify the package name with the class name at the time of it's usage.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     import statement   java import


 Q3. What does import java.util.* means in java ? Core Java
Ans. It means import all the classes and interfaces within java.util package and make them available to use within the current class or interface. This is shorthand wild card annotation for importing all classes within a particular package. This won't import the classes within the sub packages of java.util.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java import   import statement


 Q4. Do you know the way to remove unused imports automatically in eclipse ?Eclipse
Ans. Select the package -> Right Click -> Source -> Organize Imports.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     eclipse   import statement   code cleaning   code review   clean code



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: