- 1

c++ vs. java

what is the diff between c++ and jave in if statment

4th Sep 2018, 2:50 PM
Shady A. Said
Shady A. Said - avatar
2 Answers
+ 2
In C++: int i {5}; if(i) // works, assumed as true // executed on true else // executed on false In Java: int i = 5; if(i != 0) // explicit boolean expression // executed on true else // executed on false
4th Sep 2018, 4:00 PM
Ipang
+ 2
Java and C++ : if(condition){ code_if_true(); } else { code_if_false(); }
5th Sep 2018, 2:00 PM
Christopher
Christopher - avatar