If the java.awt.Graphics class is abstract then how can methods such as this.getGraphics() return a Graphics object ?
Printable View
If the java.awt.Graphics class is abstract then how can methods such as this.getGraphics() return a Graphics object ?
Polymorphism allows it to return a Graphics object because its actually calling a subclass with a method that actually returns a value.. I don't know the specifics of it but the Graphics class is a super class and then it has a blank outline out what methods each subclass has to have...
See this link for more explanation: http://java.sun.com/docs/books/tutor.../abstract.html
most likely because whatever class 'this' is an instance of inherits from java.awt.Graphics.