Testing cases in Java

As you mentioned the procedure for testing cases for code in C++ here , does the same work for Java as well?

Also, since I’m new here, I wanted to know if we are permitted to discuss the code for the questions of those contests that have already taken place?

Anyone aware of either, pls reply asap