1. Objects
(1) Everything is an object.
(2) program is a combination of a lot of objects
(3) Each object has its own storage space to accommodate other objects
(4) Each object has a type, "Class" and "type" are synonyms, and the most important feature of a class is "what message can be sent to it?" ”
(5) All objects of the same class can receive the same message
2. "Interface" (INTERFACE) specifies which requests can be made on a particular object.
3. Controlling the reason for member access
(1) To prevent programmers from touching what they should not touch-usually the design idea of internal data types.
(2) Allow the library designer to modify the internal structure without worrying about the impact it will have on the client programmer.
The 4.Java uses three explicit (explicit) keywords and an implicit (implied) keyword to set the class boundaries: public,private,protected and suggestive friendly.
(1) "Public" means that any subsequent definition may be used by any person. Maximum access control permissions, which are visible to all classes.
(2) "Private" means that no one other than yourself, the creator of the type, and the internal function member of that type can access the subsequent definition information. The most stringent Russian access control permissions, only the class itself is visible, all classes are not accessible (the reflection mechanism can be accessed).
(3) "friendly" (friendly) involves the concept of "packaging" or "encapsulation"-the method that Java uses to build libraries. If something is "friendly", it means it can only be used within the scope of the package (so this level of access is sometimes called "wrapper access").
. that is, default: package access, that is, the classes in the same package can be visible. The default package access control permission is not explicitly specified when Access control permissions are not explicit.
(4) "protected" (protected) is similar to "private", except that an inherited class can access a protected member, but cannot access a private member . The same package is visible, and all subclasses of the same package are not visible.
6. Inheritance: Reuse interface, inheritance is implemented by extends keyword.
7. Abstract the underlying classes and interfaces, using the abstract keyword.
Abstract methods may only be created in an abstract class. Once a class has been inherited, that method must be implemented, otherwise the inherited class will become an "abstract" class.
The interface (interface) keyword extends the concept of an abstract class A step further, completely prohibiting all function definitions.
8. Single-Root structure
(1) All Java classes inherit object from an underlying class.
(2) All objects in a single structure have a common interface, so they eventually belong to the same type.
(3) All objects in a single structure are guaranteed to have some specific functionality. You can perform some basic operations on each object. A single root structure, plus all objects created in the memory heap, can greatly simplify the transfer of parameters.
9. Bottom-up styling and templates/versatility
If the Exception is the wrong thing, we will get a run-time error called "violation".
10. The impact of the garbage collector on efficiency and flexibility
creating objects on the stack is one of the most efficient ways to allocate storage space for objects, and is the most efficient way to free those spaces. Creating objects in the memory heap (heap) can be a much more costly effort.
11. Violation Control: Resolve errors
"Violation control" incorporates the error control scheme into the programming language, sometimes even built into the operating system. This "violation" (Exception) belongs to a special object, which "throws" or "throws" from the place where the error occurred.
In Java, the offending control module is encapsulated from the start, so it must be used!
12. Multithreading
In a program, these stand-alone fragments are called threads, and the concept of programming with it is called multithreaded processing.
Java also provides a limited resource locking scheme. It can lock any object's memory (memory is actually one of many shared resources), so only one thread can use a specific memory space at a time. To achieve this, the synchronized keyword is used. Other types of resources must be explicitly locked by the programmer, which usually requires the programmer to create an object that represents a lock that all threads must check when accessing that resource.
13. Permanent
Java 1.1 provides support for "limited persistence", where we can simply save objects to disk and retrieve them at any time in the future. However, we still need to make explicit calls to save and retrieve objects. These jobs cannot be done automatically.
Java and the Internet
(1) Client programming: User-submitted information is uploaded to the server via the Common Gateway Interface (CGI) that all Web servers can support.
(1.1) Plugin: Using plug-ins, programmers can easily add new features to the browser, users just download some code, "insert" them in the appropriate location of the browser. The plugin is actually a "backdoor" to the browser, allowing the creation of new client programming languages (although not all languages are implemented as plug-ins).
(1.2) scripting language: Through this scripting language, you can insert the source code for your client program directly into an HTML page, and the plugin that interprets that language is automatically activated when the HTML page is displayed. The downside is that our code is all exposed to people.
(1.3) Java: The problem of client-side programming is cleverly addressed through a "tablet" (applet).
(1.4) ActiveX: Microsoft's, also specific cross-platform use capabilities
(1.5) Security: GIF files do not pose any harm to us, and scripting languages often have a big limit on what you can do. Java is also designed to run in a secure "sandbox" in its patches, which prevents operations from being located in a disk or memory area other than the sandbox.
ActiveX is one of the most worrying things in all of these. Writing programs with ActiveX is like compiling a Windows application--you can do whatever you want.
The current solution is "digital signature", the code will be verified by the authority, showing who its author is.
(1.6) Internet and intranet: If an information network is confined to a specific company, then after applying web technology to it, it can be called "intranet" to show that it is different from the international Internet.
"Java Programming thought" study note one