.
Home About-us Privacy Policy Contact-us Services

Friday, October 16, 2015

Java - Constructor Program Example - Allprogramexample

ad+1

Constructor Program Example
class cube
{
int lenth;
int width;
int height;
cube()         //Constructor initilize
{
lenth=10;
width=20;
height=2;
}
int volume()
{
return(lenth*width*height);
}
}
class cons
{
public static void main(String aa[])
{
cube cc1=new cube();

int a=cc1.volume();
System.out.println("the volum of "+a);
}}



0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates