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.
jagguyAsked:
Who is Participating?
 
for_yanCommented:
no you cannot - you need to have System.out.println("hello");
0
 
for_yanCommented:
And you do not need any imports for that
0
 
for_yanCommented:
But System should be upper case
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
for_yanCommented:
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
0
 
for_yanCommented:
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
0
 
for_yanCommented:
And out belongs to class PrintStream and then you use method println()
of that class to print
0
 
for_yanCommented:
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
0
 
CEHJCommented:
If you

import static java.lang.System.out;

Open in new window


you can do

out.println

Open in new window


but i wouldn't. Just write your own method called println if you want to call it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.