I agree. We need some more information. What exactly isn't working? Does the above code compile? If not, what errors do you get? If it compiles, what happens when it runs and how does it differ from what you expect? Is there a run-time error (i.e. an exception)? If so what message does it give?
Without this additional information, we can only guess at the intent of this code. Please provide more details so that we can answer your question. You should also take a look at some suggestions we have about How To Ask a Question at Java Ranch.
Once you fill in these details, we will be more than happy to help.