+ 16

What is meant by overriding a base class in Java?

According to one of the challenge quizzes here, you can override a base class whereas you can't override final and static methods as well as constructors. But what exactly is overriding the base class? Is it simply the extension of the class to create a subclass?

19th Mar 2019, 12:59 PM
Sonic
Sonic - avatar
10 Answers
+ 7
https://www.google.de/amp/s/www.geeksforgeeks.org/overriding-in-java/amp/ I think thats describes all what you have to know about overriding. But I'm wondering if this quiz question is formulated correct. Maybe it's common among programmers to formulate it that way.
20th Mar 2019, 3:39 AM
Denise RoƟberg
Denise RoƟberg - avatar
+ 32
Overriding means redefining the method of base class in sub class. That means the name of the method, it's parameters remains the same. Just we are redefining it.
19th Mar 2019, 1:58 PM
Jaseem Akhtar
+ 11
JaseemAkhtar ,Denise RoƟberg thanks but what you have described is overriding a method, which I already know about. I'm asking about overriding a base class which the question specifically mentioned. The answers to the question said that you can't override constructors, final methods or static methods, which is correct but that you CAN override a base CLASS. Is this the same as overriding a non-final, non-static method of the base class? It's the terminology I am confused about.
19th Mar 2019, 10:12 PM
Sonic
Sonic - avatar
+ 11
Just Googling also seems to suggest that overriding the base class loosely refers to overriding its members. Maybe I just came across a confusingly worded question.
19th Mar 2019, 10:21 PM
Sonic
Sonic - avatar
+ 11
Thanks for the effort Denise RoƟberg !! Appreciate it.
20th Mar 2019, 3:24 AM
Sonic
Sonic - avatar
+ 8
Reward At first: Create a new question and show your code, so others can help you. Second: I am not able to create a browser. It exceeds my capabilities.
21st Mar 2019, 3:37 PM
Denise RoƟberg
Denise RoƟberg - avatar
+ 6
Sonic Here is a very simple example: Class Animal (your base class) with the method makeSound(). The class Cat extends Animal. Overrides makeSound(). https://code.sololearn.com/cprv9xP0RYBA/?ref=app https://www.geeksforgeeks.org/overriding-in-java/amp/
19th Mar 2019, 3:45 PM
Denise RoƟberg
Denise RoƟberg - avatar
+ 6
Sonic Before I answered you I used also google. So I think override base class means override methods of a base class.
20th Mar 2019, 3:16 AM
Denise RoƟberg
Denise RoƟberg - avatar
+ 4
Please who can help me create a browser app and add my admob to it (just a small browser ) please I was just scammed because of this am cashless now , I promise to pay you once I get anything from admob please help me , just a domy browser even if it is only Google search thanks Sonic Mitali Punny Programmer Denise RoƟberg Tanu JaseemAkhtar Jonathan Pizarra
21st Mar 2019, 9:46 AM
Reward
Reward - avatar
+ 3
You can find it in google.
22nd Mar 2019, 6:08 AM
Jackie Neil Calago
Jackie Neil Calago - avatar