i'm researching on how to make a parameter that accepts any object, i found an answer and i tried recreating the code. but the problem is whenever i initialize Bee,Horse and Apple it always shows the error "non-static variable cannot be initialized from a static context". so how is this wrong?
public class Testing{
public static void main(String[]args){
Bee a= new Bee();
Horse b= new Horse();
Apple c= new Apple():
}
private interface holder{
public int getX();
}
private class Bee implements holder{
int a=52;
public int getX(){
return a;
}
}
private class Horse implements holder{
int a=62;
public int getX(){
return a;
}
}