class Box { double width; double height; double depth; void volume() { System.out.print(" Volume is "); System.out.print(width *height*depth); } void setDim(double width, double height, double depth) { this.width=width; this.height=height; this.depth=depth; } } class BoxDemoCon1 { public static void main (String args[]) { Box mybox1= new Box(); Box mybox2= new Box(); mybox1.setDim(10,20,15); mybox2.setDim(3,6,9); mybox1.volume(); mybox2.volume(); } }
Java Program For Finding Volume By Applying SetDimensions
January 20, 2015Bhanu Namikaze
Bhanu Namikaze is an Ethical Hacker, Security Analyst, Blogger, Web Developer and a Mechanical Engineer. He Enjoys writing articles, Blogging, Debugging Errors and Capture the Flags. Enjoy Learning; There is Nothing Like Absolute Defeat - Try and try until you Succeed.
No comments:
Post a Comment