explain System.out.println

Answer Posted / kamineni

Here System is a class available in java default package
java.lang.. It contains fields and methods that support
standard input n output facilities.System class has Final
modifier so it cant be inherited..
out is a static field in System class of PrintStream
type(printstream is a built in class contains methods to
print different data tyes)
println is the method of the printstream class to print
different values..
Example:
class System
{
static PrintStream out;
'
'
'
'
}
class PrintStream
{
void println();
void print();
'
'
'
}

System.out.println() means
System is a class and out is a static field so we acces it
by using class name..
so System.out
and println is a method of PrintStream..so non static
methods should access using reference or object and out is
the reference(holds the adress of PrintStream object) of
PrintStream so we access it using out..
so System.out.println()..

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me a few examples of final classes defined in Java API?

562


How do you clear a list in java?

603


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?

638


What is the best definition for data?

521


What is static variable with example?

562






Is java good for beginners?

581


What is independent and dependent variables in research?

470


How do you add an element to an arraylist in java?

487


What is java life cycle?

539


What is the function of http?

535


How does linkedhashmap work in java?

519


How does compareto work in java?

577


What is nested top-level class?

578


How do you compare two objects?

524


What is java english?

496