Sunday, March 2, 2014

Basic Code explination
































































































































Hi,
































































































































Im trying to teach myself a bit of java and came across the following line of code in the degrees to Fahrenheit converter tutorial:
































































































































int tempFahr = (int)((Double.parseDouble(tempTextField.getText()) )































































































































* 1.8 + 32);
































































































































I know what the code does in that it is getting the value that the user has input in text field tempTextField and is applying the mathematical calculation to convert to Fahrenheit and assigning the result to the variable tempFahr. I am going to list a number of things I assume is going on here and if anyone could correct me if im wrong or confirm if I am correct that would be brilliant.































































































































































































































































  • I am guessing any value input into a text box is considered a string?































































































































  • I am guessing that Double.parseDouble takes in a string and converts it to a double.































































































































  • I am assuming that by simply putting (int) in front of (Double.parseDouble(tempTextField.getText())) * 1.8 + 32) that it calculates the value and converts it to an int?































































































































  • The tutorial says this example is not localizable because the parseDouble method is not localizable - what does it mean by localizable?






























































































































































































































































Thanks for taking the time to look at this.































































































































































































































































No comments:

Post a Comment