1. public class TestOR {
2. public static void main( String[] args ){
3. int i = 0;
4. int j = 10;
5. boolean test= false;
6. //demonstrate ||
7. System.out.println(j++);//10
8. test = (i < 10) | (j++ > 9);//11
9. System.out.println(i);
10. System.out.println(j++);//12
11. System.out.println(j++);//13
12. System.out.println(test);
13. //demonstrate |
14. test = (i < 10) || (j++ > 9);//14
15. System.out.println(i);
16. //System.out.println(j);//1
17. System.out.println(j);//14
18. System.out.println(j++);//14
19. System.out.println(test);
20. }
21. }
O/p:
10
0
12
13
true
0
14
14
true
I couldnt understand y the value of j didnt change in the lines 17 & 18 of
the above program.
Pls suggest.
Thanks in Anticipation
Shiva.
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---