Hi All, I am very new to
Java and I am getting a 'Double cannot be dereferenced' error when I try to compile this code.
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if (source == exitButton)
System.exit(0);
else if (source == calculateButton)
{
double sideAValue = Double.parseDouble(sideAField.getText());
double sideBValue = Double.parseDouble(sideBField.getText());
double sideCValue = Math.hypot(sideAValue, sideBValue);
sideCValue.setText(Double.toString(sideCValue));
The above section of code is part of a larger program that calculates the hypotenuse of a right triangle when the user enters the two smaller sides.
The error comes from this line of code:
sideCValue.setText(Double.toString(sideCValue));
Could someone please help me to know how to fix this?