Browse - Programming Tips - Why am I getting this error from javac: error: illegal combination of modifiers: public and private

Date: 2013jan5
Language: Java

Q.  Why am I getting this error from javac: error: illegal combination of modifiers: public and private

A.  Everything in an interface must be public.  So this code
will get that error:

interface Test { private class Hello { // ERROR: things inside an interface cannot be private int abc; } }
This is a (minor) flaw in the language if you ask me. You might consider using a class instead of an interface.