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 |
Why do we use variables?
What is a treeset in java?
How do you pass by reference?
What is the memory leak in java?
What is nested loop? What is dangling else condition in it?
What is a boolean in java?
What is onClassLoader in java?
What is the arraylist in java?
What is regex java?
Hi Every One I Have Small Doubt Please answer This???????????????????????????? I Want to use AbstractList class methods(java.util.AbstractList) My Program is import java.util.*; class DemoOne extends AbstractList { public static void main(String[] args) { AbstractList a=new DemoOne();//This One is Correct?? DemoOne a1=new DemoOne();//This One is Correct?? Both Are Not Working System.out.println("Hello World!"+a); System.out.println("Hello World!"+a1); } } Error IS: DemoOne.java:2: DemoOne is not abstract and does not override abstract method get(int) in java.util.AbstractList class DemoOne extends AbstractList AnyOne can Please Provide The Solution????????????????????????? Plzzzzzzz
What are the features of java?
When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?