Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Can I import same package/class twice? Will the JVM load the package twice at runtime?
Home
JAVA
Can I import same package/class twice? Will the JVM load the package twice at runtime?
0
votes
asked
May 2, 2021
in
JAVA
by
sharadyadav1986
Can I import same package/class twice? Will the JVM load the package twice at runtime?
#package
java
jvm-load
Java-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 2, 2021
by
sharadyadav1986
One can import the same package or the same class multiple times. Neither compiler nor JVM complains about it. However, the JVM will internally load the class only once no matter how many times you import the same class.
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
0
votes
Q: How to create packages in Java?
asked
May 2, 2021
in
JAVA
by
sharadyadav1986
#package
java
Java-questions-answers
0
votes
Q: If three threads trying to share a single object at the same time, which condition will arise in this scenario?
asked
Apr 10, 2021
in
JAVA
by
Robindeniel
java
java-questions-and-answers
java-mcq
core-java-mcq
java-multiple-choice-questions
java-questions-2021
java-interview-questions
java-advanced-questions
Java-questions-answers
+1
vote
Q: What is the purpose of the Runtime class?
asked
May 5, 2021
in
JAVA
by
SakshiSharma
#runtime-class
java
Java-questions-answers
+1
vote
Q: What is package.json in node.js? What is it used for?
asked
May 31, 2020
in
NodeJS Essentials
by
Robindeniel
#package
json
#json-package
#node
js-package
0
votes
Q: Which package contains the Random class?
asked
Apr 8, 2021
in
JAVA
by
SakshiSharma
java
java-questions-and-answers
java-mcq
core-java-mcq
java-multiple-choice-questions
java-questions-2021
java-interview-questions
java-advanced-questions
Java-questions-answers
+1
vote
Q: How will you load a specific locale?
asked
May 12, 2021
in
JAVA
by
rajeshsharma
java
locale
Java-questions-answers
0
votes
Q: Can you achieve Runtime Polymorphism by data members?
asked
Apr 30, 2021
in
JAVA
by
rajeshsharma
#runtime-polymorphism
polymorphism
java
Java-questions-answers
0
votes
Q: What happens if I import the same module twice?
asked
Sep 16, 2023
in
Angular
by
JackTerrance
angularjs-interview-questions-answers
0
votes
Q: What will happen if "In a C++ program a class has no name"?
asked
Jan 24, 2021
in
JAVA
by
rajeshsharma
#c
-program
constructor
java
Java-questions-answers
0
votes
Q: Explain What is Runtime Polymorphism?
asked
Apr 30, 2021
in
JAVA
by
rajeshsharma
runtime-polymorphism
polymorphism
java
Java-questions-answers
...