Prev Next

Java / Package

1. Which package is auto imported by default in any java class?

Posted on Apr 1, 2016 by Senthil Kumar.

java.lang package and no import statement is necessary.

Read full answer

2. What is a Java package?

Posted on Apr 1, 2016 by Senthil Kumar.

Package is a collection of related classes and interfaces. Related classes will have the package defined using package keyword....

Read full answer

3. Is there a performance impact due to a large number of import statements that are unused?

No. the unused imports are ignored if the corresponding imported class/package is not used.

Read full answer

4. Difference between Java IO and NIO packages.

IO. NIO.

Read full answer

5. Difference between import and static import.

The import allows the Java programmer to access classes of a package without package qualification whereas the static import feature allows accessing the static members of a class without the class qualification. The import provides accessibility to classes and interfaces...

Read full answer

6. Can I import same package/class twice?

Yes. One can import the same package or same class multiple times.

Read full answer

7. Which package is always imported by default?

The java.lang package is always imported by default.

Read full answer

8. Does importing a package imports the sub packages as well?

No . One will have to import the sub packages explicitly.

Read full answer

9. Should package be the first statement in a Java class?

Yes . Otherwise it will produce compilation error.

Read full answer

10. Explain Java9 module.

Java module is a new feature in Java 9 via the Java Platform Module System (JPMS). JPMS Is also referred to as Java Jigsaw or Project Jigsaw....

Read full answer

«
»

Comments & Discussions