nerdexam
Oracle

1Z0-803 · Question #32

Give: Public Class Test { } Which two packages are automatically imported into the java source file by the java compiler?

The correct answer is A. Java.lang E. The package with no name. For convenience, the Java compiler automatically imports three entire packages for each source file: (1) the package with no name, (2) the java.lang package, and (3) the current package (the package for the current file). Note: Packages in the Java language itself begin withjava.

Java Basics

Question

Give:

Public Class Test { } Which two packages are automatically imported into the java source file by the java compiler?

Options

  • AJava.lang
  • BJava.awt
  • CJavax.net
  • DJava.*
  • EThe package with no name

How the community answered

(47 responses)
  • A
    91% (43)
  • B
    2% (1)
  • C
    4% (2)
  • D
    2% (1)

Explanation

For convenience, the Java compiler automatically imports three entire packages for each source file: (1) the package with no name, (2) the java.lang package, and (3) the current package (the package for the current file). Note: Packages in the Java language itself begin withjava.orjavax. Incorrect answers: Java.awt: basic hierarchy of packages for native GUI components Javax.net: networking operations, sockets, DNS lookups, etc.

Topics

#package import#java.lang#default package#compilation

Community Discussion

No community discussion yet for this question.

Full 1Z0-803 Practice