Explain.
public class Add{
private int m;
private int n;
public int Add(void)
{
m=n=0;
}
int Add(int m, int n)
{
m=m;
n=n:
} }
15. Point out errors in the following code and make corrections. Explain each change
Answers
Answered by
2
Answer:
Assuming that the code is written in java:
I)Here you forgot to take the arguments for the function
ii)You took arguments as void which makes the function useless
iii)The error in last add function is that after n colon has been used.
Correction:
Assuming that the function wants to add some thing here is the code for it:
public class Add(int m, int n) {
System.out.println(m + n) ;
}
Hope it helps u. Pls Make my answer as BRAINLIEST.
Answered by
0
Answer:
public class Add (int m ,int n){
public int Add(void)
{
m=n=0;
}
int Add(int m, int n)
{
m=m;
n=n:
system . out . printing(m+n)
} }
Explanation:
i have made some changes
rewrite the program as your ans you will get mark
Similar questions