Results 1 to 3 of 3

Thread: Java Question

  1. #1
    Senior Member
    Join Date
    Jan 2004
    Posts
    199

    Java Question

    If the java.awt.Graphics class is abstract then how can methods such as this.getGraphics() return a Graphics object ?
    -

  2. #2
    Banned
    Join Date
    Sep 2004
    Posts
    305
    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

  3. #3
    Ninja Code Monkey
    Join Date
    Nov 2001
    Location
    Washington State
    Posts
    1,027
    most likely because whatever class 'this' is an instance of inherits from java.awt.Graphics.
    "When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
    "There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
    "Mischief my ass, you are an unethical moron." - chsh
    Blog of X

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •