java - What does 'Conditional expressions can be only boolean, not integral.' mean? -
'Conditional expression can be only boolean, not integral.' What do you mean I do not know Java and I know that C + + is not deffenetly to understand what it means .. Please help (C ++ and Java item 7 has been found compared to sub-item 1)
From a logical point of view, conditional expression is naturally bullion (truth or false). However, some languages such as C and C ++ allow you to use numerical expressions or pointers as a conditional expression. When a non-Boolean expression is used as a conditional expression, then these zeros are converted into zeros in comparison. For example, you can type:
if (numeric expedition) {// ...}
and this would mean:
If (numeric expression! = 0) {// ...}
This short code allows, especially in pointer languages such as C and C ++, where testing for zero pointers is fairly common, however, it does not explicitly make clear your code in high level languages like C # or The Awa, using numerical expressions are not permitted conditional expression. If you want to check whether an object has been initialized or not, then you have to write:
If (myObject! = Null) / * (myObject) is not allowed alone / Similarly, if you want to test whether a numerical expression is zero or not, you have to write: if (NumericalExpression! = 0) / * (numeric expression) is not permitted alone * / {// ...}
Comments
Post a Comment