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

Search Java Interview Questions


 2098 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Import' - 14 question(s) found - Order By Newest

 Q1. What are concepts introduced with Java 5 ?Core Java
Anonymous
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
Anonymous
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     Gateway Media      intermediate        rare


 Q3. What is "Import" used for ?Core Java
Anonymous
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
Anonymous
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     Infosys  Weather Channel  Tata Consultancy (TCS)  ePace Technologies      basic        frequent


 Q5. Which of the following syntax is correct ?

import static java.lang.System.*;

or

static import java.lang.System.*;
Core Java
Admin
info@buggybread.com
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


 Q6. Do you know the way to remove unused imports automatically in eclipse ?Eclipse
Admin
info@buggybread.com
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


 Q7. Does importing a package imports all its sub packages too ?Core Java2017-01-12 11:02:13

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     HCL Technologies      basic


 Q8. Is it a good practice to use Asterick(*) in import statement to load multiple packages with single import statement ?Core Java2017-01-12 11:04:19

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     HCL Technologies


 Q9. Difference between import and include directive in jspJava EE2017-03-09 11:39:09

 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     ADP



Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here



 Q10. What is the importance of Abstract Class ?Core Java2017-04-30 09:37:41

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


 Q11. What does import java.util.* means in java ? Core Java2017-06-20 09:16:43

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


 Q12. 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 Java2017-06-20 09:19:15

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


 Q13. Which java package is loaded by default and hence doesn't require an explicit import statement ?Core Java2017-06-23 08:10:46

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


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

Ans.c. *



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: