system- system is predefined class to provide access to the
out - out is the output stream used to connect the
println- println is method which is tell the compiler to
write a new line in our console
The System class contains serveral useful class
fields and methods.it cannot be instantiated
The out variable in the System class refers to (points
to) an instance of the PrintStream class (a PrintStream
object) which is automatically instantiated when the System
class is loaded into the application.
println()-the println() methods in class PrintStream.
System.out.prinln("HI DILIP ");
This statement invokes the println() method of an object of
the PrintStream class which is referred to (pointed to) by
the variable named out which is a class variable of the
System is a class made available by Java to let you
manipulate various operating system related objects. It's
part of java.lang namespace.
out, being one of those objects, is a static publicly
available object inside that class. The object itself,
representing standard output, is an instance of
java.io.PrintStream class. Standard output is, on most
operating systems, console output.
println is a method of java.io.PrintStream class that lets
you output some text into the stream and, as opposed to
print() method, gets you to the new line after the text.
Check out the source for more information.
[EDIT, answer to "Additional details"] You don't need to
import java.io.* because System is part of available to all
Java calls package java.lang (you don't need to import
that). Even though out is an instance of
java.io.PrintStream, it is still declared *inside* the
System class and therefore, you do not need to import java.io.
Of course, implementation of java.lang.System needs to
import java.io (and many other packages). You can see it in
I have one Shopping cart application, i that i have
selected some items, while clicking submit button by
mistake i have clicked twice or trice, that time items are
selected twice or trice. Actually i want only one copy of
items but its selected twice or trice. So how can we avoid