I'm doing an exercise in a text box with these instructions:
Exercise 9.1: In the board game Scrabble1, each tile contains a letter, which is
used to spell words, and a score, which is used to determine the value of a
word.
a. Write a definition for a class named Tile that represents Scrabble tiles. The
instance variables should be a character named letter and an integer named
value.
b. Write a constructor that takes parameters named letter and value and initializes
the instance variables.
c. Write a method named printTile that takes a Tile object as a parameter and
prints the instance variables in some reader-friendly format.
d. Write a method named testTile that creates a Tile object with the letter Z
and the value 10, and then uses printTile to print the state of the object.
The point of this exercise is to practice the mechanical part of creating a new class
definition and code that tests it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So here's my code for this program:
So, my code compiles fine, but when I run it, I get this error:
run:
java.lang.NoClassDefFoundError: exercise9_1/Main
Caused by: java.lang.ClassNotFoundException: exercise9_1.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: exercise9_1.Main. Program will exit.
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Any ideas on whats going wrong here? This is my first time writing my own class with my own class objects, so I have no clue what I'm doing wrong right now.