Sunday, October 31, 2010

JAVA - the System class. And, the package java.lang.

System.out.print("Enter first integer: "); //prompt

System is a class. Class System is part of package java.lang. Notice that class System is not imported with an import declaration at the beginning of the program.

**By default, package java.lang is imported in every Java program; thus, classes in java.lang are the only ones in the java API that do not require an import declaration.


excerpted from "Java how to program,by Deitel"

1 comment:

  1. Example of usage of a class from an imported package:

    import java.util.Scanner;

    Scanner input = new Scanner (System.in);

    number1 = input.nextInt();

    ReplyDelete