+ 6

Isn't java platform independent? A question of sololearn challenge community.

Last day I was playing java challenge the question asked ' java is platform independent' true or false I went for true which was eventually wrong. So can u plz explain why.

2nd Apr 2019, 11:21 AM
Ayush Pandey
Ayush Pandey - avatar
5 Answers
+ 8
When Java compiler compiles the code, it generates the Byte code which is intermediate language and hence is platform independent. Now this Byte code needs an interpreter to execute on a machine and this interpreter is JVM which is platform dependent. So, Gordon , shouldn't the answer to the challenge question be true and not false 'bcz 'Java' generates the bytecode and not the machine native code like C or any other does, and hence platform independent?
2nd Apr 2019, 12:39 PM
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½ - avatar
+ 7
Ayush Pandey as Gordon agreed and suggested that answers can be wrong, I recommend you to raise issue with that question.
2nd Apr 2019, 12:44 PM
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½ - avatar
+ 6
Java is platform independent but JVM is platform dependent In Java, the main point here is that the JVM depends on the operating system ā€“ so if you are running Mac OS X you will have a different JVM than if you are running Windows or some other operating system. Reference : https://www.google.com/amp/s/www.geeksforgeeks.org/java-platform-independent/amp/
2nd Apr 2019, 11:35 AM
Gordon
Gordon - avatar
+ 4
M. Watney yes I agree with you that the quiz answer should be true. Sometimes approved quiz has wrong answer.
2nd Apr 2019, 12:41 PM
Gordon
Gordon - avatar
+ 4
I have reported that quiz question if u find u do too
3rd Apr 2019, 12:53 AM
Ayush Pandey
Ayush Pandey - avatar