Greetings everyone,
i'm currently studying java as one of my subjects at TAFE, we are starting on learning to use 2 or more methods in a single program
i have started working on an extremely simple one and i got it all working as a single method, but when i split it up and put a method call, i got a compile error "'class' or 'interface' expected" im guessing ive put my braces in the wrong spot or something and im hoping someone can help me figure out where i went wrong
import javax.swing.*;
public class q5
{
public static void main (String[] args)
{
String enter;
double number =0;
enter = JOptionPane.showInputDialog("Enter a number:");
number = Double.parseDouble(enter);
findAbs (number);
System.exit(0);
}
}
{
public static void findAbs (double number)
{
if ( number <0 )
number = -number;
JOptionPane.showMessageDialog(null,
"the absoloute value is:" + number, "Exerscise 6.1",
JOptionPane.INFORMATION_MESSAGE);
}
}
any help will be greatly apriciated. once i can get one program working it will be quite easy to modify it and study where the braces are to be placed in more complex code with 3 or more methods. thanks again for any help