Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Madeline Ross   on Feb 05 In Java Category.

  
Question Answered By: Miriam Green   on Feb 05

I want u to remember one thing(V imp).

java.lang package is loaded by default.

Which means that methods under this package can be accesses without
defining the package.

eg - System.out.println("");

what does this mean - System(a class) is in java.lang
(java.lang.System)

This class  has a "field" (not a class) "out" which is of the type
PrintStream. So out inherits the methods of PrintStream. PrintStream
has a method println().

This is how System.out.println() works.

In ur program u have used out.println();

how will the compiler know which package to check the "out function
for"


Actually out is in the package java.lang.System.

is it clear.

Check java  API for more details

http://java.sun.com/j2se/1.4.2/docs/api/index.html

Share: 

 

This Question has 8 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on can anyone tell me why I am getting this error Or get search suggestion and latest updates.


Tagged: