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

important package

 
pravanya Gullapudi
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know that java.lang is an important package. why it is important?
 
Alan Smithee
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by pravanya Gullapudi:
i know that java.lang is an important package. why it is important?


All classes directly or indirectly extend java.lang because java.lang is where the Object class resides. Since all java objects are ... well ... objects you need java.lang to be able to reference java.lang.object.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47229
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really. You are extending the Object class, not the java.lang package.

The java.lang package contains classes which are used all the time, including Object. It just so happens that in Java you don't have to import a class in the java.lang package, because the compiler looks for classes there anyway. Other languages don't have this feature; in C# for example you have to write something like "using System" at the beginning of every program to get at classes.

More about java.lang here in the API documentation.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Alan Smithee",

It has recently come to our attention that your screen name does not comply with our Naming Policy. Specifically, I refer to the "Obviously fictitious names may be locked out" part.

Please go here and edit your profile to comply.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic