aspose file tools*
The moose likes Java in General and the fly likes Hello World! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Hello World!" Watch "Hello World!" New topic
Author

Hello World!

sahan thinusha
Greenhorn

Joined: Nov 10, 2012
Posts: 10

what's the "condition" so that the following codsnippet prints both "Hello World !"
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Not possible. Either the if or the else will be executed. It's not possible to execute both.
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1464
    
    5

However, there are ways to do that in C/C++ - but I doubt if that is possible in Java


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
sahan thinusha
Greenhorn

Joined: Nov 10, 2012
Posts: 10

thanks Guys.....!!
Paul Witten
Ranch Hand

Joined: Oct 10, 2012
Posts: 86
Jeff Verdegan wrote:Not possible.

What is a world of ifs and elses if an if can be an else? Such a world would be decidedly metrosexual. Everything would be 'OK' but for some reason nothing would really work any more.

Maybe Java8 will have a "You're OK and I'm OK" feature and really screw things up. Can you imagine backward compatibility issues?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hello World!
 
Similar Threads
Operators
Clarification about Ternary operator
java website application
equals() question?
diff between System.out and System.err