Comparison of other IOS languages-Comparison Between Objc and JAVA, ios-objc

Source: Internet
Author: User

Comparison of other IOS languages-Comparison Between Objc and JAVA, ios-objc

 

1. Objc is a compilation language and JAVA is a parsing language.

Compile-type language: compile all the source programs into executable programs with binary code. Then, you can run the program directly. Compiled language, fast execution speed and high efficiency; less dependent on compiler and cross-platform performance.

Parsing language: An interpreted language is translated only when the program is running. Each statement is translated only when execution is performed. In this way, each execution of an explanatory language requires a translation, which is less efficient. Interpreted language, which is slow in execution and low in efficiency. It depends on the interpreter and has good cross-platform performance.

Objc is a dynamic language, that is, it can change the code structure at runtime, while Java is a static language. KVC and KVO in Objc fully demonstrate this feature.

 

2. Memory Management and message transmission:

Objc is the reference count, which occurs during the compilation period. Java is garbage collection, which occurs at runtime. Later, the Objc came into being with the ARC, where programmers were not required to write memory management. However, the essence of Objc was the memory management based on reference count during compilation.

The biggest difference is that Objc uses message transmission, which is essentially a string, so it can modify classes, objects, and methods at runtime. The Java method is statically bound to the class. Although it is obtained through reflection at runtime, the performance will decrease by an order of magnitude. So Objc is more dynamic.

Why is the android mobile phone experience a little poor, Because Java's garbage collection mechanism.

 

3. Code:

1) Java has a namespace package and Ojbc does not.

2) different methods are used to implement multi-inheritance. java cannot inherit multiple parent classes and can implement multi-inheritance by implementing multiple interface interfaces. Objc implements Multi-inheritance through Categories and Protocols.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.