Packages Interview Questions

    Question 1JAVA OOPS - Package Basics

    Which of the following is true about packages in Java?

    Question 2JAVA OOPS - Default Package

    Which statement is correct?

    Question 3JAVA OOPS - Creating a Package

    Which of the following correctly creates a package?

    package com.example; public class Test {}

    Question 4JAVA OOPS - Importing a Package

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

    Question 5JAVA OOPS - Accessing Classes in Package

    Which statement about access modifiers is correct for packages?

    Question 6JAVA OOPS - Sub-package Access

    Which statement is correct?

    Question 7JAVA 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 8JAVA OOPS - Java API Packages

    Which of the following is a standard Java API package?

    Question 9JAVA OOPS - Fully Qualified Name

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

    Question 10JAVA OOPS - Benefits of Packages

    Which of the following is not a benefit of packages?