[Solved] What’s wrong with my java code


Well it could be many things, If you’re a beginner in Java I’d reccomend starting with an IDE, howver if you dont want this then here is a link on 3 ways to resolve NoClassDefFoundError in Java

Here is also an extract from another user who explains why this error occurs:

I always get that error when I create a class file in a package and
then attempt to run the program from within the package. The solution
is to go up one level in your file system so that you are on the level
of the package, not of the package contents.

For example, if your package’s name is greetings and your class file’s
name is HelloWorld, your program contains the line:

package greetings;

The package name corresponds to a directory in your file system, e.g.
C:\Java\greetings. Your class file is within that directory, i.e. its
file name is C:\Java\greetings\HelloWorld.class.

If you position to c:\Java\greetings and then execute:

java HelloWorld

you get a NoClassDefFound error. If you go up one directory, in this
case to C:\Java, instead of C:\Java\greetings, and then do this:

java greetings.HelloWorld

your program should work for you.

solved What’s wrong with my java code