• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

important package

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know that java.lang is an important package. why it is important?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79232
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic