I'm very new to Java and have been experimenting with some example code. Most of it I understand (from implying knowledge of other languages) but something that I've never seen before is int
in the variable tempfahr
. To my understanding, tempTextField.gettext
is converted into a double than used in the equation. The variable tempFahr
is defined as an int so what is the need/use of the int
.
int tempFahr = (int)((Double.parseDouble(tempTextField.getText()))* 1.8 + 32);
fahrenheitLabel.setText(tempFahr + " Fahrenheit");