I'm studying for the
SCJP programmer
test and am having an issue with implementing a 'package statement'.
I have a package statement in my '.java' file which represents the path of the class file in underlying directory structure. The code should print out a single line of text. Instead, an error is thrown:
Exception in
thread "main" java.lang.NoClassDefFoundError: Example1 (wrong name: com/christiangarcia/examples/Example1)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Any idea what is going on here???