Translation takes place in Java because Java is a high-level language that cannot be executed by a computer until it is translated into a low-level language (these languages are sometimes referred to as "machine languages" or "assembly languages").
Anyway, translation in Java (and in most languages) happens in two ways: Compiling and interpreting.
The weird thing about Java is that it can be both compiled and interpreted. This is because, rather than needing to translate Java programs into the type of low-level machine language I mentioned above, the Java compiler generates Java byte code.
This byte code is similar to machine language (so a machine can interpret it) but it is also considered to be portable (a quality of a high-level language) which means the byte code can automatically be transferred and interpreted on another machine.
That's a brief overview on how translation works in Java!