CS202 Java-14
CS202 Introduction to Java
lMinor Differences
•Although data members are initialized automatically (and so are arrays, variables of primitive types used in a function (i.e., local variables) are not automatically initialized (e.g.,   int var;)
•You are responsible for assigning an appropriate value to your local variables
•If you forget, you will get an error message indicating that the variable may not be initialized.
•Also…ints are not bools in Java, you can’t use an int as part of a conditional expression like we are used to. So saying (while (x=y)) can’t happen!
•Because the result of the expression is not a boolean and the compiler expects a boolean and won’t convert from an int
•So, unlike C++ you will get an error if you make this mistake!
•