Core Java - Interview Questions and Answers for 'Import' | 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' - 15 question(s) found - Order By Newest

 Q1. What are concepts introduced with Java 5 ?Core Java
Ans. Generics , Enums , Autoboxing , Annotations and Static Import.

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

   Like         Discuss         Correct / Improve     java   java5   generics   enum   autoboxing   annotations   static import        rare

Try 1 Question(s) Test


 Q2. Can I import same package/class twice? Will the JVM load the package twice at runtime?Core Java
Ans. One can import the same package or same class multiple times. Neither compiler nor JVM complains wil complain about it. And the JVM will internally load the class only once no matter how many times you import the same class.

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

   Like         Discuss         Correct / Improve     java   import   jvm   advanced     Asked in 1 Companies      intermediate        rare


 Q3. What is "Import" used for ?Core Java
Ans. Enables the programmer to abbreviate the names of classes defined in a package.

  Sample Code for import

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

   Like         Discuss         Correct / Improve     java   import   java keyword


 Q4. What is a Static import ?Core Java
Ans. By static import , we can access the static members of a class directly without prefixing it with the class name.

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

   Like         Discuss         Correct / Improve     java   java5   static import   static   java keyword   static import     Asked in 4 Companies      basic        frequent


 Q5. Which of the following syntax is correct ?import static java.lang.System.*;or static import java.lang.System.*;Core Java
Ans. import static java.lang.System.*;

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

   Like         Discuss         Correct / Improve     java   static import   generics   import   OCJP   SCJP   Oracle certified java developer     Asked in 1 Companies


 Q6. Is it a good practice to use Asterick(*) in import statement to load multiple packages with single import statement ?Core Java
Ans. No, we should be lean in loading only packages which are required. Loading packages which are not being used result in memory overheads.

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

   Like         Discuss         Correct / Improve     import  import packages     Asked in 1 Companies


 Q7. 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


 Q8. Why do we need to specify import statement ? Don't you think Java could have been designed in such a way to automatically import everything that's in the class path ?Core Java
Ans. Java could design it in such a manner but would result in ambiguity if there are multiple files with the same name. The only way to get over it to show the message when you use any such class to provide explicit import with the package prefix. The other problem could be that Java might have to change the early import to Late import and check what's being used to decide what needs to be imported as otherwise you will see errors regarding the ambiguous imports with duplicate file name.

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

   Like         Discuss         Correct / Improve     import      expert


 Q9. 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


 Q10. Does importing a package imports all its sub packages too ?Core Java
Ans. No, but we can use wild card (*) to do so

For example -

import java.util.*

will import all packages with name starting with java.util

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

   Like         Discuss         Correct / Improve     package   import packages     Asked in 1 Companies      basic


 Q11. Difference between import and include directive in jspJava EE
 This question was recently asked at 'ADP'.This question is still unanswered. Can you please provide an answer.


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

   Like         Discuss         Correct / Improve     JSP  import and include directive in jsp     Asked in 1 Companies


 Q12. What is the importance of Abstract Class ?Core Java
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as code reuse through inheritance ( extending abstract class )

Comparing to concrete class they have an advantage of providing interface which a concrete class doesn't provide.

Comparing to interfaces they have an advantage of providing code reuse through inheritance which interfaces dont provide.

  Sample Code for abstract class

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

   Like         Discuss         Correct / Improve     abstract class  importance of abstract class      Basic        frequent


 Q13. 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


 Q14. 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


 Q15. Import / Export can import data set from ..Amazon Web Services (AWS)
Ans. S3, EBS and Glacier

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

   Like         Discuss         Correct / Improve     aws import / export  aws s3  aws storage  amazon cloud storage  amazon s3  aws ebs  aws glacier


 Q16. Which of the following wildcard is used to import multiple packages at once ?Core Java
a. .
b. ?
c. *
d. &

Ans.c. *


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: