If class B and class C extend class A and I have an object of type B or C, how can I determine of which type
We can use reflection in this case
objectName.getClass().getName();
Example:-
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String name = request.getClass().getName();
}
In this case you will get name of the class which object pass to HttpServletRequest interface refference variable.