There is no equivalent to fork() in Java. The best you can do is start a thread to handle child code.
With fork(), the child process is actually a separate process, so resource conflicts are not a problem. Furthermore, with fork(), both the parent and child will execute the code after the if-then-else block. Again, there is no equivalent to this in Java.