Results 1 to 3 of 3

Thread: Point of java interfaces?     submit to reddit submit to twitter

  1. #1
    Cerberus
    Join Date
    Jun 2006
    Posts
    432
    BG Level
    4

    Point of java interfaces?

    In my computer programming course we are currently doing abstract classes / java interfaces. I don't quite understand the point of an interface, since its just a bunch of blank method names, is the only point of it so you don't forget to include a certain method in the main code?

  2. #2
    Ridill
    Join Date
    Oct 2005
    Posts
    10,210
    BG Level
    9
    FFXI Server
    Asura

    Quote Originally Posted by Mala
    In my computer programming course we are currently doing abstract classes / java interfaces. I don't quite understand the point of an interface, since its just a bunch of blank method names, is the only point of it so you don't forget to include a certain method in the main code?
    Blank method names are sorta like function declarations in C++. You do it so Java knows what to expect later. In terms of abstract classes in general, empty methods are there so classes you make that inherit (or implement) that class knows what methods are supposed to be in it. You can define the code for the function in your non-abstract class that implements the abstract one, and any further inheritance after that can either leave the code the same as its parent, or redefine it.

  3. #3
    Cerberus
    Join Date
    Jun 2006
    Posts
    432
    BG Level
    4

    Thank you.