Question:
Help! Java programs can execute on different platforms because: ?
anonymous
2008-12-10 21:35:06 UTC
a. floating point variables are used
b. Java source code is compiled directly into native code
c. Java programs are written in machine code
d. different data types are supported
e. none of the above


thank you 10 points for you!!
Seven answers:
TRON
2008-12-10 21:51:04 UTC
Java code is compiled into bytecode which is run within the Java Virtual Machine. None of the options in the answers fit it.



e. none of the above

Final Answer.
insane
2008-12-10 22:28:33 UTC
b. Java source code is compiled directly into native code



Java is compiled to an intermediate form called byte-code. A Java program never really executes natively on the host machine. Rather a special native program called the Java interpreter reads the byte code and executes the corresponding native machine instructions. Thus to port Java programs to a new platform all that is needed is to port the interpreter and some of the library routines. Even the compiler is written in Java. The byte codes are precisely defined, and remain the same on all platforms.



The second important part of making Java cross-platform is the elimination of undefined or architecture dependent constructs. Integers are always four bytes long, and floating point variables follow the IEEE 754 standard for computer arithmetic exactly. You don't have to worry that the meaning of an integer is going to change if you move from a Pentium to a PowerPC. In Java everything is guaranteed.
danielle:}
2008-12-10 22:00:29 UTC
b. Java source code is compiled directly into native code



because Java is a high level programming language and it needs to be converted into machine language. The conversion happens when you compile your program so that when you run it, it works the way you want it. The middleware that makes this possible is the JVM or java virtual machine. JVM is almost always built in every computer nowadays so that you can compile and run your java programs anywhere.
wortham
2016-10-03 12:34:32 UTC
you want a java progression kit, many times suggested as a jdk. Use any textual content cloth editor to create the java source record. Use javac to assemble the source. Use java to execute. for example notepad MyClass.java javac MyClass.java java MyClass in case you would be doing assorted programming, i might advise an integrated progression ecosystem (IDE). the main usually happening loose ones are eclipse and netbeans. An IDE is composed of all you may do those 3 steps, and makes it much less confusing and much less tedious.
darens
2008-12-10 21:57:50 UTC
B, since the code is not compiled but run on the native Java VM
Craig R
2008-12-10 22:20:41 UTC
Another bad question. None of the answers are correct because the premise of the question is that Java programs can execute (unaltered, identically) on different platforms when in fact that isn't necessarily true.
Rob
2008-12-10 21:39:42 UTC
if i had to make an educated guess, i would say b, only because the compilation in java converts all programming into binary.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...