Java,android Study "1" overview

Source: Internet
Author: User

If the program's data covers both the code and the data part:

process-oriented programming is based on code, control data with code, describe the method of solving the problem.

process-oriented programming is based on abstract data, all processing around the data expansion, relying on abstract programming

Programming language Knowledge Points:

1. Process Control : Use If...else, while, break,continue instead of too strong, poor structure, inconvenient to read the Goto.

For, Switch,foreach can make the code more concise and clear.

2. function : As the program code becomes more and more large, it becomes difficult to grasp the whole world, and it is possible to use very similar operations many times, so the function is born.

Consider a part of the code as an organic whole, cut out and name the programming mechanism (easy to understand and reusable, with early subroutine titles). Stack.

3. Error Handling :

    • The error message is communicated with the return value and the reference parameter. C,go Adopt this model
    • You can append error types and exception handling mechanisms that can proactively trigger errors.
      • C + +, java,c# using throw, try ... catch
      • Java,c# can use the Try ... catch ... finally. With finally, there is only one exit, which implements the no-omission execution of the operation.
      • JAVA uses a check-type exception to explicitly declare an exception that might run out because "the trouble with Checked Exceptions", so C # is not inductive.
      • Swift had previously adopted the C model, and the 2015 developer conference mentioned the introduction of exception handling mechanisms.

4. Naming and scoping (dynamic scope, global scope, static scope), namespace. Public private protected internal

5. type : How data is read and depends on the type information people attach to the data.

    • How the CPU stores the operands: Little_endian (from low bytes to high bytes) and Big_endian (from high to low).
    • In 2 binary notation 10, approximately 3.32 (log10/log2) bit bits represent one bit.
      • Plastic Surgery : The highest bit is the sign bit. Negative numbers are in the form of a complement, which translates subtraction into addition. ( complement: In addition to the position of the sign counter and add 1 )
      • floating point :

Take 32-bit as an example:

The highest bit is the sign bit,

The next 8 bits represent the exponential portion of the number of bits (0~255, minus 127, get overflow in -127~128,-127 table: 0,128 overflow on table: Infinity or infinity, remaining digits)

The remaining 23 digits are the tail part, which represents the part below the decimal point (by moving the decimal point to make the integer part the fractional part after 1).

Example: 1.75 binary: 1.11, no shift required, symbol bit: 0, exponent part 0111,1111 (127), tail part: 110,0000,0000,0000,0000 (0.5 + 0.25)

3.875 binary: 1.1111 * 2, sign bit: 0, exponential part 1000,0000 (128 right Shift one), tail part: 111,1000,0000,0000,0000

Range: -126/3.32 ~ 127/3.32 approx. -38~38

Accuracy: 23/3.32, 6~7 digits available

64-bit sign bit is 11 bits

Range: -1022/3.32 ~ 1023/3.32 approx. -308~308

Accuracy: 52/3.32, 15~16 digits available

  

Custom types: structs, unions, enumerations, classes . Use the base data type to define a new type by combining.

Access control: Feature-enabled encapsulation, code decoupling

abstract classes, interfaces

Generics, templates

Dynamic type

6. Container (data structure):

7. Objects and Classes

Objects in object-oriented programming are real-world models. There are many ways to induce and build models, different languages, different choices, and classes are the most convenient, but not necessary.

JS by putting functions and variables into a hash to achieve the function of the associated functions, variables to be lumped together.

In a functional language, the form of closures is used.

Perl uses the form of a package

8. Inheritance

Using encapsulation to build an abstract data model, but only encapsulation is not enough, things are generally connected, but also need to inherit and polymorphic to describe their relationship

Inheritance needs to be used with caution, otherwise the code is less readable and difficult to extend. Follow the Richter replacement principle

C + + is multiple inheritance, multi-inheritance is easy to use, but there will be conflicts, the Java solution is to allow only single inheritance, with the interface to achieve multiple inheritance functions. Simultaneous single inheritance facilitates unified management of memory.

9. Abstract class, interface

Abstract classes can have an abstract method

And the interface, all methods are abstract methods

----------------

The programming language was born to seek convenience, precisely because of the different needs of convenience. has led to the invention of various programming languages.

The choice of language design:

Ease of use and functionality, security and efficiency, stability and scalability.

C: Structured programming + efficient + powerful + easy to learn

Born in 1972

The C programming language 1978 was formally published by the American Telephone and Telegraph Company (T) Bell Laboratory in C language

1989.12 the first complete C language standard, referred to as "C89", but people also used to call it "ANSI C".

The latest standards were released on December 8, 2011, called iso/iec9899:2011, referred to as "C11".

C + +, invented in 1979, originally called "Band C", 1983 formally renamed C + +

Emphasis on code execution efficiency, the language specification is very complex.

JAVA 1991 Conception, 92 preliminary implementation, 95 public release.

The goal is to achieve architecture neutrality, and the development of the World Wide Web has made Java possible because the World Wide Web requires portable programs. Java's sense of network programming is just like the meaning of C for system programming: It's a revolutionary force to change the world.

Java,android Study "1" overview

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.