Short answer: Yes.

Eclipse and Netbeans are just two different development environments. They're there to make the writing java easier, but you could write java in notepad and when compiled it would still provide the exact same result, as long as the text is the same. The only difference between them is the features like auto-completion, suggestions, insertion of boilerplate code and what have you.