Help Us Improve. Please let us know if you were asked any of these questions.

More Questions

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 package ?


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


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


 Stay Updated with Java Posts directly to your mailbox.
Enter your email address:

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


Try our new Java Interview Questions Search Tool.

There are more than 1000 questions with practice tests.

It's updated daily and It's Awesome.


Try our new Java Practice Test tool.

There are more than 200 questions and expanding quickly. It's updated daily and It's Awesome.