Jump to content


Photo

What is 'System', 'out', 'println' in System.out.println







  • Please log in to reply
8 replies to this topic

#1 ChetanaS






Posted 18 March 2006 - 12:08 AM

- PLEASE SHARE

Dear Chetanaites,
I am starting the discussion with a basic question on JAVA. Write your answers for this. Feel free to discuss. Try to be clear in your explanation. I will try to post few questions everyday that are asked in various company J2EE interviews. However I am not that good technically. So it's up to you to be active, discuss & clarify your doubts, reply to others, help them etc. Lets grow together.

If you have any other JAVA/J2EE questions, open a new thread and post it. Lets improve ourselves technically.

Question of the Day :- 18 March 2006
----------------------------------------------------------------
What is "System", "out", "println" in System.out.println ? Explain !
----------------------------------------------------------------


#2 Sumathi.R

Sumathi.R

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 19 March 2006 - 12:57 PM

Dear Chetanaites,
I am starting the discussion with a basic question on JAVA. Write your answers for this. Feel free to discuss. Try to be clear in your explanation.

If you have any other JAVA/J2EE questions, open a new thread and post it. Lets improve ourselves technically.

Question of the Day :- 18 March 2006
----------------------------------------------------------------
What is "System", "out", "println" in System.out.println ? Explain !
----------------------------------------------------------------

System is a predefined class that provides acess to the system.
out is the outputstream that is connected to the console.
println() - Displays the String which is passed to it.

#3 ChetanaS

ChetanaS

    Administrator

  • Root Admin
  • PipPipPip
  • 46,355 posts

Posted 19 March 2006 - 01:12 PM

What class is System ? Is it just a normal class ? I want more details !!!!!!!!!!!! ;)

#4 BanuM

BanuM

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 20 March 2006 - 12:16 PM

System.out.println()

System is a built-in class present in java.lang package.
This class has a final modifier, which means that, it cannot be inherited by other classes.
It contains pre-defined methods and fields, which provides facilities like standard input, output, etc.

out is a static final field (ie, variable)in System class which is of the type PrintStream (a built-in class, contains methods to print the different data values).
static fields and methods must be accessed by using the class name, so ( System.out ).

out here denotes the reference variable of the type PrintStream class.

println() is a public method in PrintStream class to print the data values.
Hence to access a method in PrintStream class, we use out.println() (as non static methods and fields can only be accessed by using the refrence varialble)

System.out.println();

eg:

int i = 3;
System.out.println(i);


the above code prints the value of 3 in the screen and brings the control to the next line.


#5 Sumathi.R

Sumathi.R

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 20 March 2006 - 11:06 PM

All java programs automatically import java.lang package.This package defines a class called System.The System class holds a collection of static methods and variables.the standard input,output and error output of the java runtime are stored in in,out,err variables.
Some of the methods of System Class are:
static long currentTimeMillis() - Return the current time in terms of milliseconds.
ex:
long timeinsec = System.currentTimeMillis();

static String getProperty(String prop) - Returns the property associated with prop.
ex:
class displayuserdir
{
public static void main(String a[])
{
System.out.println(System.getProperty("user.dir"));
}
}

#6 boopathykandasamy

boopathykandasamy

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 04 August 2010 - 04:09 PM

System.out.println: here system represents the class, out represents the object(io object) prinln represents the method

#7 coolseema.23

coolseema.23

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 04 August 2010 - 04:27 PM

Hi!I am new to the site, still upto my knowledge System is a class,Out is an object & Println is the method that sends the text or anything in it to the standard output device like monitor with a new line feed.More discussion is possible if other threads come!Thanks

#8 k sampath kumar

k sampath kumar

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 03 August 2011 - 09:21 PM

system is a class which cant be inherited it is from java.lang.packageout is the final variable in the class which can be access by the class name println is the method

#9 aditya_2cl

aditya_2cl

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 31 July 2013 - 10:02 AM

QUOTE (ChetanaS @ Mar 18 2006, 12:08 AM) <{POST_SNAPBACK}>
Dear Chetanaites,
I am starting the discussion with a basic question on JAVA. Write your answers for this. Feel free to discuss. Try to be clear in your explanation.

If you have any other JAVA/J2EE questions, open a new thread and post it. Lets improve ourselves technically.

Question of the Day :- 18 March 2006
----------------------------------------------------------------
What is "System", "out", "println" in System.out.println ? Explain !
----------------------------------------------------------------
System is a predefined class that provides acess to the system.
out is the outputstream that is connected to the console.
println() - Displays the String which is passed to it.

 

yeah in short you are right .i spend a half day to understand it and finaly had a postmortem of SOP in my blog  http://javatuts24.bl...and-out-in.html