-
Going crazy
I think I have been looking at it too long. I have this simple code but cannot see what is wrong with it. I think my error is in the static main but am absolutely stuck. Thank you for any help.
public class Triangle
{
public static void main(String[] args)
private double base;
private double height;
public Triangle ()
{
base = 1;
height = 1;
}
public Triangle (double b, double h)
{
base = b;
height = h;
}
public double computeArea()
{
double area;
area = .5 * base * height;
return area;
}
}
-
Re: Going crazy
Please post the full text of the error messages.
Please Edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.
-
Re: Going crazy
Since you're not using an IDE, I suggest that you start your program creation with the most bare of program "skeletons", say nothing but the class name and the main method and nothing more. Compile this code to make sure it works, and then every time you add a line or two of code, compile the code to check for errors. Don't add any new lines until you've fixed all errors and your current code compiles well. This will prevent you from adding more code to an already broken program.