on 08-25-2009 8:31 AM
Hi Experts,
I have to write following logic in form of Java statement. How I can do so?
If condition 1 (value = 1)
do..
If condition 2 (value = 2)
do..
If condition 3 (all values other than 1 and 2)
do..
How I can write Java statement for above?
Regards,
Gary
Hi,
Use switch/case : [The switch Statement|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html].
EDIT : or you can use if-then-else for non primitive data types : [The if-then and if-then-else Statements|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html].
Regards,
Pierre
Edited by: Pierre DOMINIQUE on Aug 25, 2009 10:05 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.