How does java work?

A Java compiler takes the imputed code and compiles byte-code. This code is then interpreted by the Java interpreter. This compiling method allows the code to versatile, working on cellular devices, the web browser, and on your hard-drive.