• More than 1000 Questions
  • Test Questions to revise
  • New Questions added Daily
  • Search by Topic, Level, Frequency & Company
  • Actively Moderated by experienced developers

Search Java Interview Questions

Best Java Question Repository on web.   Click Here

Java - Interview Questions and Answers on Packages

Q1.  What does the default access specifier means ?

Default - Accessible from anywhere within same package.

Q2.  Can I import same package/class twice? Will the JVM load the package twice at runtime?

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.

Q3.  Do we need to import java.lang.package ?

Ans. No, It is loaded by default by the JVM.

Q4.  What is the difference between public class and class ?

Ans. Class without any access specifier has the default scope i.e it can be accessed by any class within same package. 

Class declared public can be accessed from anywhere.

Q5.  Name few classes that are part of java.io package ?

Ans. http://www.buggybread.com/2015/01/java-javaio-classes-and-interfaces.html

Q6.  Name few classes that are part of java.lang package ?

Ans. http://www.buggybread.com/2015/01/java-javalang-classes-and-interfaces.html

Q7.  Name few classes that are part of java.util package ? 

Ans. http://www.buggybread.com/2015/01/java-javautil-classes-and-interfaces.html

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