May 28, 2007

JAVA program to demonstrate function

class demo
{
void add() // method definition
{
int a,b,c;
a=10;
b=20;
c=a+b;
System.out.println(c);
}
};


class adddemo
{
public static void main(String[] args)
{
demo d1;
d1 =new demo();
d1.add(); // calling of a function
}
}

No comments:

Post a Comment

Infolinks In Text Ads

Total Pageviews

Powered by Blogger.

Dont Forget To Follow Us