This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

alternative available for If Else condiotion

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using if ..else condition in my code for condition based coding...Is there any alternative available for If Else condition in java..!! please advise..!!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why? What's your beef with "if"?

If this is an interview question, please let us know. Such questions rarely make real-world sense and it'll save a lot of time trying to figure out why you are asking the question in the first place.
 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Why? What's your beef with "if"?

If this is an interview question, please let us know. Such questions rarely make real-world sense and it'll save a lot of time trying to figure out why you are asking the question in the first place.


It is just for my knowledge ...is there any alternative available to if else block!!
 
Paul Clapham
Sheriff
Pie
Posts: 20758
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knowledge is not acquired by making up random questions.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saral Saxena wrote:
Bear Bibeault wrote:Why? What's your beef with "if"?

If this is an interview question, please let us know. Such questions rarely make real-world sense and it'll save a lot of time trying to figure out why you are asking the question in the first place.


It is just for my knowledge ...is there any alternative available to if else block!!


There are several possible alternatives. Which ones are applicable depends on exactly what you're doing in your if.

And of course, one has to ask why you want an alternative to if. In what way do you find it not suitable for the specific thing you're doing?
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Switch statement
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic