Abstract Methods
I understand what an abstract class is, a class that you don't want an instance created of. What is an abstract method used for?
Static Methods
I understand what a static variable is, i.e one that is shared by every instance of the class and not created separately for each instance. How does this relate to methods? Surely all methods are static and the same method is shared by every instance. What is the point of creating a copy of the same method for instance?
Interface
I'm pretty sure I understand Interfaces. Correct me if I'm wrong, an interface is a list of un-implementated (i.e declaration but no body) methods that the class that uses it MUST use. Correct? I understand putting unimplementated methods in an interface but whats the point having constants in there?
Final Keyword
Is the only reason for creating a final class for security, to prevent un-authorized sub-classing? Is it good practice to do anyway?
Packages
Why for example when I have a single .java file program and I add 'package myStuff;' to the top it comes up with a long error on runtime? Everytime I add the word package to the top of 1 or more .java files I get errors? What am I doing wrong?
Thanks alot
Dom
I understand what an abstract class is, a class that you don't want an instance created of. What is an abstract method used for?
Static Methods
I understand what a static variable is, i.e one that is shared by every instance of the class and not created separately for each instance. How does this relate to methods? Surely all methods are static and the same method is shared by every instance. What is the point of creating a copy of the same method for instance?
Interface
I'm pretty sure I understand Interfaces. Correct me if I'm wrong, an interface is a list of un-implementated (i.e declaration but no body) methods that the class that uses it MUST use. Correct? I understand putting unimplementated methods in an interface but whats the point having constants in there?
Final Keyword
Is the only reason for creating a final class for security, to prevent un-authorized sub-classing? Is it good practice to do anyway?
Packages
Why for example when I have a single .java file program and I add 'package myStuff;' to the top it comes up with a long error on runtime? Everytime I add the word package to the top of 1 or more .java files I get errors? What am I doing wrong?
Thanks alot
Dom