What is the difference between these two piece of code
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
is that inner interface of View class, if so we know that interface can not be instantiated
And here
soInterface.getAnswers().enqueue(new Callback<SOAnswersResponse>() {
@Override
public void onResponse(Call<SOAnswersResponse> call, retrofit2.Response<SOAnswersResponse> response) {
}
@Override
public void onFailure(Call<SOAnswersResponse> call, Throwable t) {
}
});
its callback that it required in the enqueue method, what this syntax define, is it interface "CallBack<>" defined some where and we are calling it here as inline interface, but again interface can not be instantiated like callback syntax says "new CallBack(){}"