Can you define what you mean by "right"? As a programmer, there are many tools to help you know if a piece of code is "correct". The first one is the compiler. So does this code compile without any errors? If so, then you are on the first step.
The next thing is to understand what the code is supposed to DO. One way to check if a program DOES the right thing is to run it. At the moment, your code is not a complete program since there is no main() method. It is often helpful to write small programs that
test only portions of your code, rather than writing the complete program and running it. Testing is its own field and it takes time to figure out how to test any particular code.
With that said, please come back with mroe questions. It will help a lot if you have SPECIFIC questions that we can answer.
Layne