Back To Java User Defined Methods Index
//program to create a function that finds volume of a box (width, depth and height of box are passed to function as arguments) class volumea { public void volume(int width,int depth,int height) { int vol; vol=width*depth*height; System.out.println("volume of box is " + vol); } } public class volume { public static void main(String[] args) { volumea ob=new volumea(); ob.volume(10, 20, 30); } }