- 1
c++ vs. java
what is the diff between c++ and jave in if statment
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
+ 2
Java and C++ :
if(condition){
code_if_true();
} else {
code_if_false();
}