Hi Frnds,
What is System.out.println..?How this three are related..?

Recommended Answers

All 3 Replies

System.out.println(String s) simply gets the Java console to print out a line of text. Surely you came across it in Hello World?

Which three are you referring to? The "System" "out" and "println" parts of the command? If so, read it this way, System.out uses the default output stream, and println is a stream command which tells the stram to display a line of text. The link below will take you directly to the System.out field entry of the API.

More details can be found here, the Java API. I suggest that you bookmark it.

System is a class, using it directly in this manner means you want to use a public static item from it.

out is the public static item you are using. It is an OutputStream that is used for the Standard Output (STDOUT, there is another for STDERR) of the running java application.

println() is of course a method of an OutputStream object that prints bytes to the device pointed to by the OutputStream object. In this case, usually the command line or an Application Console, unless redirected.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.