Help Us Improve. Please let us know if you were asked any question in your interview.

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


Stay updated with Java posts in your email.

Enter your email address:


Delivered by FeedBurner
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




×

Would like to 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.


×

Would like to try our new Java Practice Test tool.

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