I am new to Java and learning about data types, and how to convert them to other data types using the helper classes.
The issue I am having is I am getting the following compilation error "cannot find symbol" however I don't think I should be. I Read this SO question which makes sense, and while it helped me understand the problem, it did not help me solve it.
It seems to throw an error based on the name of my variable. Shouldn't I be able to name my variable anything I want (almost anything).
My very simple code:
public class file {
public static void main(String[] args) {
double oldDub = 450.6d; //initial double value
Double newDub = new Double(oldDub); //create instance of above value
float floatValue = newDub.floatValue(); //create a new data type using instance above
int intValue = newDub.intValue(); //this works
int randomVar = newDub.randomVar(); //this doesn't work
}
}