Results 1 to 2 of 2
  1. #1
    bugger is offline Senior Member
    Join Date
    Nov 2007
    Posts
    111
    Rep Power
    0

    Default subclass vs inner class

    Hi,

    What is the difference between subclasses and inner classes? I believe both does the same job but there is difference in their syntax. Please confirm.

    Chao.

  2. #2
    afsina is offline Member
    Join Date
    Jan 2008
    Posts
    24
    Rep Power
    0

    Default

    No. A subclass is class which inherits a method or methods from a superclass. like:
    Java Code:
    class Car{
    }
    
    class HybridCar extends Car {
    }
    HybridCar is a subclass of Car.

    innerclass is a class defined inside another class. they are a type of "nested classes"
    Java Code:
    class OuterClass {
        ...
        class NestedClass {
            ...
        }
    }
    read here for a better definition.

Similar Threads

  1. Replies: 0
    Last Post: 04-02-2008, 07:04 AM
  2. Replies: 0
    Last Post: 02-17-2008, 09:03 AM
  3. Replies: 5
    Last Post: 01-03-2008, 07:54 AM
  4. which class is superclass and subclass?
    By java_fun2007 in forum New To Java
    Replies: 0
    Last Post: 12-11-2007, 08:55 PM
  5. SubClass problems
    By ravian in forum New To Java
    Replies: 1
    Last Post: 11-19-2007, 05:54 PM

Posting Permissions

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