Posted on 2004-04-23
I'd just like to check that my understanding of OOP is correct.
Classes & Interfaces
-An interface method must not contain a body.
-When an interface is implemented, all variables are inherited and all methods must be over written
-An interface can be a child (?) of another interface........?
-An abstract class cannot be instantiated
-When extending an abstract class, all abstract methods must be over written
-When extending an abstract class, all methods and variables are inherited
Final classes.... (I'm a bit unsure of this)
-A final class CANNOT be extended
-A final class can be instantiated
-Nothing can be changed in an instance of a final class... (E.g. no get or set methods)
-A public class can be accessed from any class in any package
-A public method can be accessed from any class in any package ONLY if being accessed via an instance of its class
-Private methods can only be accessed from the class it's contained in.
-If a class containing a private method is extended....the private methods will not be inherited (?)
-A static method can be accessed without creating an instance of its class (e.g. class name is "MyClass" and method name is "myMethod" then it could be accessed like so... MyClass.myMethod();)
I've got no idea about final methods. Can someone please explain how these work?
I'm not really sure about these methods... I know it’s got something to do with any sub class of it but an explanation would be great :)
This is just personal homework so hopefully one day I'll become a Certified Java programmer.
I'd prefer an explanation of anything I've got wrong or miss understood however I'm still happy to accept links.
Thanks in advanced.