There are 2 classes. Parent class has method --> public void abcd(int i)
and child class has override that -->public void abcd(Integer i)
Is this possible because same method name but int used in parent class and Integer I have been used in child class.
Practice.java
public class Practice {
public void abcd(int i){
System.out.println("Hi");
}
Practice2.java
public class Practice2 extends Practice{
public void abcd(Integer i){
System.out.println("oh child");
}
public static void main(String[] args) {
Practice p = new Practice();
Practice p2 = new Practice2();
p2.abcd(1); //Is this possible
}
}
I got this below error The method abcd() in the Practice is not applicable for the arguments(int) int and Integer are same right? why it is not accepting?