Created
February 15, 2017 18:07
-
-
Save 2013techsmarts/294f792eeb268cd97962f353ab76d439 to your computer and use it in GitHub Desktop.
Demonstration of private method error scenarios
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> public interface Sample { | |
...> | |
...> private void doSomeThing(); | |
...> | |
...> } | |
| Error: | |
| missing method body, or declare abstract | |
| private void doSomeThing(); | |
| ^-------------------------^ | |
jshell> public interface Sample { | |
...> | |
...> private abstract void doSomeThing() { | |
...> | |
...> System.out.println("Private method !!!"); | |
...> | |
...> } | |
...> | |
...> } | |
| Error: | |
| illegal combination of modifiers: abstract and private | |
| private abstract void doSomeThing() { | |
| ^------------------------------------... | |
jshell> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment