• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hello World!

 
sahan thinusha
Greenhorn
Posts: 10
Android Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what's the "condition" so that the following codsnippet prints both "Hello World !"
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not possible. Either the if or the else will be executed. It's not possible to execute both.
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However, there are ways to do that in C/C++ - but I doubt if that is possible in Java
 
sahan thinusha
Greenhorn
Posts: 10
Android Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Guys.....!!
 
Paul Witten
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic