wood burning stoves 2.0*
The moose likes Java in General and the fly likes System.out.println() question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "System.out.println() question" Watch "System.out.println() question" New topic
Author

System.out.println() question

Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Hi All,

One of the interviewer asked the below question

In main method we have out.println("world") stmt . After executing this we want output as Hello world . How will you write code without calling any method of other class or not passing runtime input from args[].

Can you guys please give your input.

Thanks in advance....

- Chetan
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

after returning main? if yes:look for threads else include one more out.print ;)
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 146

Hi Seetharaman ,

Thanks for the reply . Yes it is in the main() so will return output in the excution .

Can you please give some input on how to do it with threads.

Thanks ..

-Chetan
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
It says after executing this. Did you ask exactly what they mean by that? Simply leaping in with a solution is far less likely to get you appointed than asking lots of questions.
Gaurangkumar Khalasi
Ranch Hand

Joined: Jun 02, 2012
Posts: 187
Chetan Dorle wrote:In main method we have out.println("world") stmt . After executing this we want output as Hello world . How will you write code without calling any method of other class or not passing runtime input from args[].


Gaurangkumar Khalasi
Ranch Hand

Joined: Jun 02, 2012
Posts: 187
Try out...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Gaurangkumar Khalasi wrote:Try out...
That should work, yes.
Michael Krimgen
Ranch Hand

Joined: Jul 08, 2012
Posts: 35
just another idea. Here you can modify the initial output however you like:



Cheers,
Michael
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: System.out.println() question