Jesper Young wrote:Are you sure that your code compiles? It shouldn't, because you are creating a new Math object with: Math m = new Math(); but your class Math does not have a constructor that takes no arguments.
Like Rob requested you before, in future, while posting code, please UseCodeTags I have edited your original post to incorporate them. As you can see it makes the code much more readable and easier to understand.
charushila ingale wrote:you are true and i want addition of those number which are given by user mean i want addition of number 2 and 3
I guess you want the addition and subtraction to be done with the numbers that the user types in.
What you'll have to do is first input the numbers, and then create the Math object, passing it the numbers you've just gotten from the user (x and y). You'll have to move line 7 of your source code down to around line 19.
Take your time, carefully look at the source code line by line, and make sure that you understand what each line of code is doing exactly - follow the flow of the program, so that you understand what the whole program is doing exactly.
I am sure you meant well, but please do not post ready made solutions. The best way to learn is by making mistakes and identifying the mistakes.
I hope you appreciate this and take it in the right spirit.