Although 2 methods are declared below still on Ctrl + space getting msg as "No proposals". How to rectify this? (ss attached for reference)
I am trying to write the below code for polymorphism, however getting error when creating instance of object. Please help with this:
package Polymorphism;
public class Test
{
Test obj = new Test();
obj.add(40, 20); //getting error on this line
obj. // Although both the methods are declared below still on Ctrl + space getting msg as "No proposals"
public static void main(String[] args)
{
}
public void add (int x, int y)
{
x = 10;
y = 12;
int z=x + y;
System.out.println("the value of z: " + z);
}
public void add (int x, int y, int a)
{
x = 10;
y = 12;
a = 24;
int z=x + y+ a;
System.out.println("the value of 3 numbers z is:" +z);
}
}