0% found this document useful (0 votes)
3 views1 page

Java Util for Basic Arithmetic Operations

Uploaded by

Harish Maadhav R
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Java Util for Basic Arithmetic Operations

Uploaded by

Harish Maadhav R
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

import [Link].

*;

class Sum
{
public void add(int a, int b)
{
int c;
c = a + b;
[Link]("ans = " + c);
}

public void sub(int a, int b)


{
try
{
int c;
c = a - b;
[Link]("diff = " + c);
}
catch(Exception e)
{
[Link](e);
}
}
}

class Function101
{
public static void main(String arg[])
{
Scanner t = new Scanner([Link]);
int a, b;
[Link]("Enter a:");
a = [Link]();
[Link]("Enter b:");
b = [Link]();

Sum sum = new Sum();


[Link](a, b);
[Link](a, b);
}
}

You might also like