How could we know what it'ssupposed to do and what's going wrong without seeing your exact code and the exact, complete error message? "Exception in main thread" is only part of the error message and really only tells you that *something* went wrong. There will be a whole bunch more stuff that will tell you exactly what and exactly where.
When you post code, please use[code] and [/code] tags as described in [url=http://forum.java.sun.com/help.jspa?sec=formatting]Formatting tips[/url] on the message entry page. It makes it much easier to read.
> I created a coin program that has a setKey, unlock,
> locked, and lock methods. I got the program to
> compile. However, I was wondering if it is supposed
> to run. When I run the program I receive exception in
> main thread error.
No, just because a program compiles there still may be programming errors in it. Some errors can only be detected when the program runs.