What is the difference between “architecture-neutral” and “portable”?

前端 未结 9 951
忘了有多久
忘了有多久 2020-12-14 12:40

I\'m reading Herbert Schildt\'s book \"Java: The Complete Reference\" and there he writes that Java is portable AND architecture-neutral. What is the difference between this

9条回答
  •  旧巷少年郎
    2020-12-14 13:28

    Looking around I found another book that describes the difference between the two.

    For architecture neutral the compiler will generate an architecture-neutral object file meaning that compiled Java code (bytecode) can run on many processors given the presence of a Java runtime.

    For portable it means there are are no implementation-dependent aspects of the specification. For instance in C++ an int can be 16-bit, or 32 bit depending on who is implementing the specification where as in Java an int is always 32 bit.

    I got my information from a different book (Core Java 2: Fundamentals) so it may differ from his meaning. Here is a link: Core Java 2: Fundamentals

提交回复
热议问题