jagguy
asked on
println
IN java , can i use just println and remove the system.out
println("Hello, World"); //i want this
is there an imports namespace or something.
println("Hello, World"); //i want this
is there an imports namespace or something.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And you do not need any imports for that
But System should be upper case
this is class System
http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html
it is part of java.lang. which will be imported by default
as this is name of the class it should be upper case and Java is case sensistive
http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html
it is part of java.lang. which will be imported by default
as this is name of the class it should be upper case and Java is case sensistive
out is a static varibale of class System so you just append it after dot to the class name without any instance System.out
http://docs.oracle.com/javase/1.5.0/docs/api/java/io/PrintStream.html
http://docs.oracle.com/javase/1.5.0/docs/api/java/io/PrintStream.html
And out belongs to class PrintStream and then you use method println()
of that class to print
of that class to print
if you just leave it
println(..)
it will look fro the method println(..) of the same class which you are creating and if you did not define such method it will complain that there is no such m,ethod in your class
println(..)
it will look fro the method println(..) of the same class which you are creating and if you did not define such method it will complain that there is no such m,ethod in your class
If you
you can do
but i wouldn't. Just write your own method called println if you want to call it
import static java.lang.System.out;
you can do
out.println
but i wouldn't. Just write your own method called println if you want to call it