Cube Program Example
class cube
{
int len;
int width;
int hei;
int volum() //Method Definaton
{
return(len*width*hei);
}
}
class cube2
{
public static void main(String aa[])
{
cube cc=new cube();
cc.len=60;
cc.width=20;
cc.hei=10;
int vol=cc.volum(); //Calling a method
System.out.println("The Volum of cube "+vol);
}}
class cube
{
int len;
int width;
int hei;
int volum() //Method Definaton
{
return(len*width*hei);
}
}
class cube2
{
public static void main(String aa[])
{
cube cc=new cube();
cc.len=60;
cc.width=20;
cc.hei=10;
int vol=cc.volum(); //Calling a method
System.out.println("The Volum of cube "+vol);
}}
0 comments:
Post a Comment