Calling an overridable method from a not overridable method | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Calling an overridable method from a not overridable method

For example: public class Example{ //Not overridable public void a(){ b(); } //Overridable public void b(){ } } I want only b() overridable. I can't use final, static or private keywords with a(). Any ideas?

13th Feb 2020, 8:33 PM
Stefano Trinca
Stefano Trinca - avatar
1 Answer
+ 2
public final void a() should work. I've made a small example. Hope it helps. https://code.sololearn.com/co5d5GMTUUIU/?ref=app
15th Feb 2020, 12:23 AM
Denise Roßberg
Denise Roßberg - avatar