0
It says I have one problem with my method calling
It's says cannot find area() đ˘ class Triangle{ double base; double height; double area(){ return base*height*0.5; } } public class Triangle1 { public static void main(String[] args) { Triangle T1=new Triangle(); T1.base=8; T1.height=20; System.out.println("the answer is"+area()+"cm"); } }
2 Answers
+ 1
You need to call the method on the object.
System.out.println("the answer is "+T1.area()+" cm");
0
Avinesh thanks I just realized it before your message entered am so grateful đ