explain System.out.println
Answers were Sorted based on User's Feedback
Answer / prashant
System : It is a java class in the java.lang package.
Out : it is a static field in System class.it holds the
reference of an object of the class printStream.
Println() : it is the method in the
PrintStream class.
so because out is static we can call it using class name
and because of it is returning object we can call methods
present in the object.and one of the method is println.
| Is This Answer Correct ? | 12 Yes | 11 No |
Answer / indranil singha
class Indranil{
void prin(){
System.out.println("Indra");
}
}
class Indra{
static Indranil ob=new Abc();
}
class Test{
public static void main(String args[]){
Indra.ob.prin();
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / budhaditya biswas
System is a class of Java.lang package which is automatically imported in Java program. Out is a predefined Stream variable which is public and static within System. System.out is an object of PrintStream type.println is a method.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vinod pillai
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.
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)
Example:
class Student
{
final int value=30;
void display()
{
System.out.println("Final Value is:"+value);
}
}
class Temp
{
static Student obj1=new Student();
}
class Main_String_Prog
{
public static void main(String args[])
{
Temp.obj1.display();
}
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / anup
----> public final class System extends Object <------
Directory Structure is as follows:
java.lang.Object
|
+--java.lang.System
System class has following static field-
static PrintStream out =new PrintStream();
directory Structure of PrintStream:
java.lang.Object
|
+--java.io.OutputStream
|
+--java.io.FilterOutputStream
|
+--java.io.PrintStream
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / tirath pal singh sisodiya
System.Out.println()
System-System is the final class of the java.lang package it
can not be inherit.
Out-out is the static Object of the PrintStream class which
located in java.io package.
for call any static object with class name then we use
System.Out
println()-println() is the method of printStramClass .
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / 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 |
Answer / arun
System is a class provided by package java.lang
println() is a method of class Printstream provided by
package java.io
out is output stream to which value and objects will be
printed.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / arumugam.k
System - it is a Class. Its define java.lang Package.
out - it is a predefined stream variable.
println() - used to print the result on console output screen.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / anand_pbc
System is a final class in java.lang package
out is "PrintStream" type of static field in System class
(The "standard" output stream)
println is a method in class PrintStream (this is class is
in java.io package)
| Is This Answer Correct ? | 1 Yes | 0 No |
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion
What is difference between null and void?
Why does java have different data types for integers and floating-point values?
What is the use of flag?
Can we use static class instead of singleton?
How do you reverse a string in java without using string buffer?
how to print output with out using sop statements
Explain how to force the garbage collection in java.
how to convert mm/dd/yy to dd/mm/yy using collections in java.
explain about method overloading and method overriding with difficult examples
What is difference between local variable and global variable?
what is difference between interface and abstract class..?