Packages Interview Questions

    Question 1: JAVA OOPS - Package Basics

    Which of the following is true about packages in Java?

    Question 2: JAVA OOPS - Default Package

    Which statement is correct?

    Question 3: JAVA OOPS - Creating a Package

    Which of the following correctly creates a package?

    package com.example; public class Test {}

    Question 4: JAVA OOPS - Importing a Package

    How do you import the `Test` class from `com.example` package?

    Question 5: JAVA OOPS - Accessing Classes in Package

    Which statement about access modifiers is correct for packages?

    Question 6: JAVA OOPS - Sub-package Access

    Which statement is correct?

    Question 7: JAVA OOPS - Package with Multiple Classes

    What will be the output?

    package com.example; public class A { public void show() { System.out.println("A"); } } class B { void display() { System.out.println("B"); } }

    Question 8: JAVA OOPS - Java API Packages

    Which of the following is a standard Java API package?

    Question 9: JAVA OOPS - Fully Qualified Name

    How can you access `Test` class without importing package?

    Question 10: JAVA OOPS - Benefits of Packages

    Which of the following is not a benefit of packages?