I have to do a program to school in Assembler but we did just a few basic things. Is it possible to write code in Java and convert it to Assembler?
closed as off-topic by gnat, Jörg W Mittag, candied_orange, maple_shaft♦ May 16 '17 at 18:24
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking for assistance in explaining, writing or debugging code are off-topic here. These can be asked on Stack Overflow if they include the desired behavior, a specific problem or error, and the shortest code necessary to reproduce it in the question (see Minimal, Complete, and Verifiable Example)." – gnat, Jörg W Mittag, candied_orange, maple_shaft
Yes you can. While normally Java is compiled to bytecode executed by JVM, there are compilers that output native code. For example,
gcc has Java front-end, the
gcj, so you can use that along with
-s option (which emits assembly output instead of machine code).
Having said that, don't expect to fool anyone. Your teacher will instantly recognise that your code has not been written by you.