Skip to content

Instantly share code, notes, and snippets.

@2013techsmarts
Created February 15, 2017 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2013techsmarts/294f792eeb268cd97962f353ab76d439 to your computer and use it in GitHub Desktop.
Save 2013techsmarts/294f792eeb268cd97962f353ab76d439 to your computer and use it in GitHub Desktop.
Demonstration of private method error scenarios
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