aspose file tools*
The moose likes Beginning Java and the fly likes java.lang Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java.lang" Watch "java.lang" New topic
Author

java.lang

Rob Keefer
Greenhorn

Joined: Feb 18, 2002
Posts: 26
I have noticed that the classes available in java.lang are available whether I import this package or not. This has made me curious:
1. Do I ever have to import the java.lang package?
2. Are there other packages that are automatically available?
3. Is there a good description somewhere of the real "core" of Java? - i.e. the features that are available when nothing is imported.
- Rob
Jason Brawner
Ranch Hand

Joined: Dec 19, 2001
Posts: 66
1. Nope. java.lang is imported automatically.
2. None that I'm aware of.
3. Check out the javadoc of the java.lang package. They are the only classes that are guarenteed to be available. Other classes could be available without an import, for example, classes in the same directory of a non-packaged class.
Hope this helps,


Jason E. Brawner<br />Sun Certified Java Programmer<br />Sun Certified Web Component Developer
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Rob
java.lang and java.math are both automatically imported for you into your classes. they are the only two, any others you would have to explicitly import yourself.
As far as what you can use with out importing anything:
-- anything from java.lang
-- anything from java.lang.Math it is included in this
-- any methods from the Object class (it is in java.lang) if that is the class you extend to make your classes
[ February 27, 2002: Message edited by: Dave Vick ]

Dave
Rob Keefer
Greenhorn

Joined: Feb 18, 2002
Posts: 26
Thanks ...
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
java.lang and java.math are both automatically imported for you into your classes. they are the only two, any others you would have to explicitly import yourself.
As far as what you can use with out importing anything:
-- anything from java.lang
-- anything from java.lang.Math ...

java.lang and java.lang.Math
not java.math
Try it.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
I fixed it after I realized what I had done
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang