How are compilers and interpreters used in one language?


After the complete code has been written, the compiler compiles all the code at once, while the interpreter takes only one line. Both the compiler and the interpreter are usually referred to as language translators.
how both are used in a language like java.