In: Computer Science
There’s one thing every coder must understand.
The System.out.println command.
There’s one thing every coder must understand.
The System.out.println command.
Ans:- For understanding this, Consider following code:
public class System{
public static final PrintStream out;
.......
}
public class PrintStream{
public void println(){
}
public void println(String s){
}
-----------
many overloaded method
}
Now if we want to use method println() then how it should be called
System.out.println() //depends on its argument
System ->class in java.lang package
out -> PrintStream object reference which is static variable of System class, so access through( System.out)
println() -> Method in PrintStream class which is accessed by out(object reference variable) (System.out.println())
Pseudocode for System.out.println()
Class System
BEGIN
Declare variable for PrintStream as out
Implement other method of class
END
class PrintStream
BEGIN
implement method println()
implement method println(String s)
implement method println(String,operator,other type variable)
---------------------
other overloaded method
END
class Test
Begin
main()
begin
System.out.println("Hello World")// calling method println()
end
END
Flowchart
Please let me know if you have any doubt or modify the answer, Thanks :)