My question is quite easy, but I cannot figure out how to implement what I want.

I would like to implement a method which, depending of the given parameter, returns one subClass or another (I understand that I could have this behavior in some class to make the development more object oriented, but I'm still learning).

So I thought of this solution, but it does not compile.

```
public abstract class A(){
    //some code
}

public class B extends A(){
    //some code
}

public class c extends A(){
    //some code
}

public static void main(String[] args) {
    System.out.println("input: "); 
    Scanner console = new Scanner(System.in); 
    String input=console.nextLine();
    A myObject = getObject(input);

}

public static <? extends A> getObject(String input){
    if(input.indexOf("b") != -1){
        return new B();
    }
    if(input.indexOf("c") != -1){
        return new C();     
    }
    return null;
}

```