Solved

println

Posted on 2012-03-14
8
330 Views
Last Modified: 2013-11-24
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.
0
Comment
Question by:jagguy
  • 7
8 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 37722749
no you cannot - you need to have System.out.println("hello");
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37722752
And you do not need any imports for that
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37722756
But System should be upper case
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37722759
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 47

Expert Comment

by:for_yan
ID: 37722763
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37722765
And out belongs to class PrintStream and then you use method println()
of that class to print
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37722768
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 37722808
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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now