Java OCA OCP Practice Question 1092

Question

The following are the complete contents of Main.java file.

Which packages are automatically imported?

class Main{ 
   public static void main (String [] args){ 
     System.out.println ("hello"); 
    } 
} 

Select 2 options

  • A. java.util
  • B. System
  • C. java.lang
  • D. java.io
  • E. String
  • F. The package with no name.


Correct Options are  : C F

Note

System is not a package. It is a class in java.lang package.

String is a class in java.lang package.

If there is no package statement in the source file, the class is assumed to be created in a default package that has no name.




PreviousNext

Related