Solved

println

Posted on 2012-03-14
8
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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
 
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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

688 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