To allow the user to change the parameters you can ask the user to input them using JOptionPane, you can also use this to display the message:
public class TriangleArea {
public static void main(String[] args) {
double side1 = getDouble("Length of the first side");
double side2 = getDouble("Length of the second side");
double side3 = getDouble("Length of the third side");
double s = (side1 + side2 + side3) / 2;
double area = Math.sqrt(s * (s - side1) * (s - side2) * (s - side3));
JOptionPane.showMessageDialog(null, "area of the triangle is " + area);
}
/**
* Ask the user to input a double. Will continue asking until a valid double is input.
* @param message
* @return
*/
public static double getDouble(String message) {
while(true) {
try {
return Double.parseDouble(JOptionPane.showInputDialog(message));
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(null, "That is not a valid number, try again");
}
}
}
}
To allow the user to run this by double-clicking it in Windows you can build a JAR file from it. I'm not familiar with Netbeans, but according to this answer on a question on how to do that you can enable it under:
Project Properties -> Build -> Packaging -> Build JAR after compiling
The JAR should show up somewher in your project when you build. Note that it will require your users to have a working installation of Java of the same version or later than you're using.