class aman
{
public static void main(String args[])
{
func ob=new func();
int ans=ob.sum(10,20); //function call
System.out.println("the answer is = " +ans);
ob.product(20,50); //function call
}
}
class func
{
int sum(int a, int b) //function with return type
{
int c=a+b;
return c;
}
void product(int a, int b) // function with no return type
{
int c=a*b;
System.out.println("the product is = " +c);
}
}
No comments:
Post a Comment