Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.out.println()....need explanation

 
omar salem
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi greenhorns.....i need explanation for the structure of the 'System.out.println()' statement.....thanks in advance
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi omar salem.

the Question is already been discussed in javaranch forum.
have a look this thread
[ August 22, 2007: Message edited by: Saif uddin ]
 
omar salem
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Saif....i really appreciate it
 
xiao sean
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

it's actually mean break;

for eg.
System.out.println("Hello");
System.out.println();
System.out.println("How are you");

it will print as
Hello

How are you.
 
Muhammad usman shad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
println is the method from wich we can put a string on the out stream that is in the System object.
This is a syntax of Java used to display a string on the console window or the computer screen.
If you execute:
System.out.println("Hello, world!"),
you will get:
Hello, world.
on the computer screen.

System is the object that represents the computer.
Out is a stream on that.
Print and Println are methods on that out stream.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not quite. System is a class; I am not sure whether it is instantiated to an object or not. It has three static fields, out (not Out) in and err which are streams.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System has only a private constructor and can't be instantiated. All its methods and member variables are static.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Ernest, for sorting out my uncertainty.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic