Try / catch with a private method [closed]
Try / catch with a private method [closed] I am trying to call a method that is private inherited from the super class (I KNOW THAT YOU CAN NOT CALL IT IN MAIN BECAUSE IT IS PRIVATE) However, I am trying to use a try catch statement that keeps running my program and give me an exception saying "This method cannot be Called because it is private" (EXAMPLE) this is what I have on my try / catch public int num1 = 3; try { superClass.methodOne(num1); } catch(Exception e) { System.out.printf("%s","ERROR: methodOne cannot be executed! IT IS PRIVATE"); } This is the error that it gives me! error: methodOne(int) has private access Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the que...