Answer the question
In order to leave comments, you need to log in
What is the difference between and in Java?
For example, I create a parent class from which everything will be inherited:
public class Parent <T extends Parent>{
private T element;
public Parent <T> set (T element){
this.element = element;
return this; // Возращаем копию класса.
}
public T get (){
return element;
}
}
public class Child extends Parent <Child>{}
public class Child2 extends Parent <Child>{}
public class Parent <T> { // Без extends Parent
private T element;
public Parent <T> set (T element){
this.element = element;
return this; // Возращаем копию класса.
}
public T get (){
return element;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question