the draw(shape s) method is declared abstarct in the Graphics2D class then can someone explain that how is it able to perform any functionality at all because according to me if a method is abstract it doesn't have any definition .
The implementation is *somewhere*. The fact that the method is abstract, doesn't mean it doesn't have an implementation. The implementation is simply not in that class, but in a subclass. You shouldn't worry about it, you can still use the method.