Introduction to Java : Data Types and Operators Part-2
Data Types
Java is a “strongly typed language”. That means that type of every variable must be declared.
Consider the following simple variable assignments:
boolean isASwingDancer = true;
int age = 30;
In other words, Java requires that if a variable is meant to hold a boolean, it is declared as such. The same goes for ints and every other data type.
Once you declare a variable, it can never be changed to hold another type of value.