Today I've been working with generic/parametric types in java () exercising my polymorphism understanding but since quite some time now I've been having an issue where I would have a generic class with a single method that returns a value, the reason is because I want to be able to call a method and by context been able to have different return types
class dummy <E>{
E value;
public E getValue(){
return value;
}
class dummy1 extends dummy<E>{
int value;
public int getValue(){
return int;
}
class dummy2 extends dummy<E>{
boolean value;
public boolean getValue(){
return boolean;
}
Is this possible? I'm not really sure if even this is the correct way of doing this kind of thing