Somehow, I am getting an JNI error for the code below when using an abstract. This shouldn't happen as I think I have wrote it correct. Can please someone have a look.
package Abstraction;
public class Abstraction1_After {
public static void main(String[] args) {
Iphone obj = new Iphone();
Samsung obj1 = new Samsung();
showPrice(obj);
}
public static void showPrice(Phone obj) {
obj.showPrice();
}
}
abstract class Phone {
public abstract void showPrice();
}
class Iphone extends Phone {
public void IphonePrice() {
System.out.println("Price of Iphone Xr is 500€");
}
}
class Samsung extends Phone {
public void Samsungs9Price() {
System.out.println("Price of Samsung S9 is 600€");
}
}