File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang

 
Rob Keefer
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
Dave Vick
Ranch Hand
Posts: 3244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rob Keefer
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ...
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dave Vick
Ranch Hand
Posts: 3244
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed it after I realized what I had done
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic