0
Error i am not getting.can anyone find it.
public class Box { double ht,wt,dp; Box(double h,double w,double d) { double h=ht; double w=wt; double d=dp; } double vol() { return ht*wt*dp; } } class Boxdemo { public static void main(String[] args) { Box ob=new Box (10,20,30); double vol (); vol =ob.vol(); System.out .println ("volume="+vol); } }
2 Answers
0
remove () while declaring vol in main function.
you are using vol as variable not function.
0
I have used it both as function and variable so it was giving an error now its running as i used it both with same name.Anyways thanks.