Can I import same package/class twice? Will the jvm load the package twice at runtime?



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

Answer / Bharat Kumar Rajak

No, you cannot import the same package or class twice. The JVM loads classes only once and shares them among all classes that use them. If you try to import a class twice, it is treated as an error.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Advanced Java Interview Questions

What is deadlock?

2 Answers  


When a thread blocks on i/o?

1 Answers  


Can we sent objects using Sockets?

1 Answers  


What is the return type of interrupt method?

2 Answers  


What must a class do to implement an interface?

1 Answers  


Can you write Java code for declaration of multiple inheritance in Java ?

6 Answers   Kingshir, Oracle,


When is the best time to validate input?

1 Answers  


What are the ways to define classes that can be run as threads?

1 Answers   KPIT,


can we write implementation for a method with in another method?

3 Answers   Cap Gemini,


Difference between hashmap and hashtable?

1 Answers  


What is checkpoint? How to create checkpoints in our java projects?

1 Answers   ABC,


How is serialization used generally ?

3 Answers  


Categories