Author Topic:   Package Problem
New To Java
posted May 08, 2000 09:11 AM           
I compiled the following code, but I don?t understand why
System.out.println did not cause a compile error. I did not
include any import package statements. Does the JDKTest.class created contain the byte code associated with System.
Does the vm provide the System package. Help.

public class JDKTest
int x=0;
public JDKTest()
System.out.println("value x="+x);

Ajith Kallambella
ranch hand
posted May 08, 2000 09:36 AM             
Hey New To Java,

The System class is defined in the java.lang package which gets included automatically with every source code, whether you specify it or not. Check out the java API documentation for other classes in java.lang package. To use any of these classes, you don't have to have explicit imports.

Hope this helps.


[This message has been edited by Ajith Kallambella (edited May 08, 2000).]

maha anna
posted May 09, 2000 04:52 AM             
New to Java,

As Ajith said all classes in java.lang package are imported automatically. If you include import java.lang.*; also ok. No problem.

You can refer to the On-line Java API here. Bookmark this API link. It will really help you a lot.

maha anna