Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

explain System.out.println

Answer Posted / anil kumar

System is a final class in java.lang package

println() is a method define in PrintStream class of
java.io package.
the Printstream class like as

Class PrintStream
{
public void print()
{..........}
public void println(String a)
{...........}

..
..
..

}
and the System class like as

class System
{
public static void PrintStream out;

..
..
out=new PrintStream();
}

this is clear that System is a class and println is a
method but what is out.

out is a reference variable of PrintStream Type that hold
the object of printstream class;
out is a static type so it can be call with its class name
so we can access out with System.out and then we can call
println method on this out object
System.out.println();

now why sunmicrosystem do this
because we haveto not create a new object of Printstream
class for each time when we call println mehod
now we can call println method with the help of precreated
object of printStream class

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is stringwriter?

955


What will happen if a thrown exception is not handled?

1022


What is stringbuffer in java?

1062


Can we able to pass objects as an arguments in java?

1026


What is the difference between java applets and applications?

1161


Is singleton class immutable?

967


What is a singleton class? Give a practical example of its usage.

1102


Is it safe to install java on my computer?

1143


What is numeric function?

1018


Can vector have duplicates in java?

951


What are the basic concepts of OOPS in java?

1036


What is instance example?

954


when a request is generated from apache tomcat 5.5 and goes to oracle 10g or mysql,,, how the oracle or mysql reads the request as apache is a web server and oracle 10g is application server? when the oracle 10g provides response, how the apche tomcat reads it???

2162


What are encapsulation, inheritance and polymorphism?

1013


What is the purpose of the finally clause of a try-catch-finally statement in java programming?

954