Which of the following is/are true about packages in Java?
1) Every class is part of some package. 2) All classes in a file are part of the same package. 3) If no package is specified, the classes in the file go into a special unnamed package 4) If no package is specified, a new package is created with folder name of class and the class is put in this package.
(A) Only 1, 2 and 3
(B) Only 1, 2 and 4
(C) Only 4
(D) Only 1 and 3
Explanation: In Java, a package can be considered as equivalent to C++ language’s namespace.
Quiz of this Question
- Java | Packages | Question 2
- Java | Java Packages | Question 3
- Java | Constructors | Question 6
- Java | Inheritance | Question 1
- Java | Constructors | Question 1
- Java | Exception Handling | Question 8
- Java | Functions | Question 11
- Java | Exception Handling | Question 7
- Java | Data Types | Question 3
- Java | Functions | Question 10