I have developed a student registration system using java. I want to implement it using interface, abstraction overloading and overriding. Please let me know if I have used the concepts in my code below, any help would be highly appreciated. I am very new to java programming and still struggling how to use these concept in my code.
Asked
Active
Viewed 149 times
1
-
i can't see any overloading and abstraction concept implemented , interface and overriding is there though – Pavneet_Singh Dec 25 '16 at 11:47
1 Answers
2
As Pavneet Singh said you have used interfaces and overriding methods. These are shown by your public interface insert_delete
and the line @Override
above your methods.
You may be wondering why you override interface methods as by default they have no code in them but this is explained in this answer.
As for the abstract part, you do not seem to of used it. You can read more about what an abstract
class in Java
is here.
Finally, method overloading is where you have two or more methods with the same name but different arguments.
For example, you might have
public void insert() {
//Your code
}
public void insert(int position) {
//setPosition(position)
//Rest of your code
}
So when you go back to see your code you will see you have not used this either. You can read more about it here
I hope this helps clear some things up for you
-
sir if i add public void insert(String query, String msg) throws ClassNotFoundException { conn=connect_to_mysql.getConnection(); – Alex D Rex Dec 25 '16 at 13:39
-
sir if i add public void insert(String query, String msg) throws ClassNotFoundException { conn=connect_to_mysql.getConnection(); this except second insert method will it be overload? – Alex D Rex Dec 25 '16 at 13:40
-
@AlexDRex Yes that will be. Just remember to put it in a try catch block if you use it as you throw an exception – Dan Dec 25 '16 at 13:41