explain System.out.println
Answers were Sorted based on User's Feedback
Answer / rajashekhar p
exactly System.out.println();
Solution
System is a Predefined public final class in the
java.lang package.
and out is the static variable of type PrintStream.
and println() method is contain in PrintStream class..
Hence we can invoke this method through class name (i.e
System)
code like as follows........
final class System{
static PrintStream out;
}
class PrintStream{
println();
-----------
------------
}
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / nivrutti
'system' is a public class which is final which can never
be extended..It does not extends object.
'out' is the static variable of the class PrintStream desclared in system class.
'println()' is the method of printStream class..
since 'out' is a static variable it can be called by using
the class name'system'
so 'Sstem.out.println()'
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ramu.gadde
System:It is the class Name which is available in java.lang
package.
out: is the static variable(public static final
java.io.PrintStream out)
Analysis of out variable:
So many people are conflict about this out,
a)Either it is object or variable.
Reason:In java there is no static object(means with static
keyword it is called variable only)
println:is a method which is available in
Java.io.PrintStream class)
the step is considered by java team like this
class System
{
public static final java.io.PrintStream out=new PrintStream();
------
}
So they called System.out.println()
I think u understand about this completely.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / shyam
It is quite simple to understand the question but to answer it we need to dig deeper in to java native code.
System is static class and cannot be instantiated
out is a reference variable defined in System
println() is the method used to print on standard output.
A <a href = "http://www.javastudychannel.com/forum/2114-What-out-System.out.println-Java.aspx">brief and nice explanation</a> is always welcome on this as we can learn much from this single line of statement itself!!
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ramanjaneyulu.b
-->System is a class name
-->out is an object of a class
-->println is the printstream
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / avinash
in c print and in c++ cout and in java
system.out.println()
system is classand package and out is an object of the
class printstream println is method of the printstream
printing string on console
Is This Answer Correct ? | 11 Yes | 11 No |
Answer / uday
'system' is a public class which is final which can never
be extended..It itself extends object.
'out' is the static object of the class PrintStream.
'println()' is the method of printStream class..
since 'out' is a static object it can be called by using
the class name'system'
so 'Sstem.out.println()'
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ashwani
system has a final class which can never instantiated by
other class. it has a private constructor has private or
private constructor never call, it call by jvm.
out: out is field type of static printer writer.
println: has a method of printsteam .
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sachin
System.out.println();
System - System is class
Out - Is an object of output stream (PrintStream class)
which is static and defined in System class.
Println()- Method from PrintStream class which use to write
output
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ramu.gadde
System is the class name which is Available in
java.lang.System class
out is a static variable which is also available in
java.lang.System class
println is the method which is available in
java.io.PrintStream class
Is This Answer Correct ? | 0 Yes | 0 No |
Can we have more than one package statement in source file ?
What is difference between fail-fast and fail-safe?
What are the two environment variables that must be set in order to run any java programs?
Can string be considered as a keyword?
How does list work in java?
What is the use of singleton?
How is java created?
What are the java ide’s?
How many bits are used to represent unicodde,ASCII,UTF-16 and UTF-8 characters?
To obtain design information about an object, which class in used?
What are selection structures?
What for read() function?