18. Find the error in the given program code:
(i) public class Add
{
private double sum;
public int getdata (float a,float b)
{
sum = a+b;
}
public int inputdata()
{
System.out.print((a+b);
}
(ii) public int getdata()
{
sub= num1 - num2;
System.out.println("Subtraction="+sub);
}
Answers
Answered by
2
Answer:
here
Explanation:
static variables are associated with the class and are therefore, not allowed inside a method body
Similar questions