Introduction to programming thinking in Java
Chapter 1 everything is an object
Everything is an object, not what Bruce Eckel said, but the first of the five basic features of Smalltalk summarized by Alan Kay. From the perspective of the program designer or source code, I have to vomit: Everything is an object, X. Type is an important concept in computer science (type theory). From the perspective of object technology, JAVA Source Code does not contain any objects. Everything is of the type, reference variable, or reference, but there is no object. In order to simulate nature (whether idealistic or physical), I fabricatedPlato's Law: the world of classes exists independently, and the object world is created by classes.
Mixed Language or multi-paradigm programming is a hype that is currently inconclusive. According to Thomas? In the paradigm theory, the old and new paradigms cannot be contracted or compared. I personally think that the command paradigm and function paradigm look at the world at the atomic level, while the object paradigm looks at the world from the macro perspective of meters.
2.1 use a handle to manipulate the object you manipulate objects with references. Please don't use handle in 3rd. How can I use a handle in version 4 translation.
Although I am in introduction to programming 2. 4.2 variables, references, and objects can be referenced in different languages. However, so if you want to hold a word or sentence, you create a string reference:
String S;
But here you 've created
OnlyThe reference, Not an object. As soon as a book is introduced
(Reference) variable sI don't like it very much. 2.2 All objects must be created 2.2.1 and saved to any place. The six places are messy. To discuss the storage management policy, do not involve registers and persistent objects.
2.2.2 Special case: the basic type, "Creating a variable instead of using new, but creating an" automatic "variable that is not referenced.
This variable holds specific values and is placed in the stack for more efficient access.". This sentence is as risky as I say "like Liang Bo. I like Liang Bo, but I don't know what to think about. "
The object is in the heap, and the basic type is in the stack."It was the invention of the master, which is a bit suspect here. 2.2.2 Java Data Types ·
4. 100% object-oriented?[P69 for Java type systems, there are basic types in Java, they are not reference types, so some people say that Java is not 100% object-oriented. Java cannot claim that "Everything is an object ".
In fact, the special reference types encapsulated by APIs-the packaging class (Boolean, byte, character, short, integer, long, float, and double ), programmers can completely prevent any basic types in the source code (convert any text into a packaging object through automatic packing ).It is very easy to implement in Java and JVM..
For
Method call stack data, Processing Integer I is not as straightforward as processing Int J. Because all objects are allocated memory on the stack, the method call stack uses the Basic Java type (such as for simple operations like 2 + I ),
Should not be forcedCreate various objects.
Even though it is easy to perform underlying conversions on the JVM, the source code is 100% object-orientedIs not necessary .] The advantages of using the Java basic type on the method call Stack are described here, but it does not mean that the Java basic type must be on the stack.
[Boolean 1--Boolean ]??? I don't know where the reason is.
2.2.3 Java Array
2.3 never clear the scope of object 2.3.1
2.3.2 scope of the object ["Memory leak," in which a programmer forgets to release memory.] This is a Java memory leak, not a C ++ memory leak.
2.4 create a new data type: I have modified some translations of the class and various headers. 2.4.1 fields and Methods his fields should not include static.
2.5 method, independent variable, and return value function vs. method, method 3.1.2 ·
4. Side effectsIn PASCAL, subprograms/methods are divided into two types: functions and processes. [Methods in Java determine the messages an object can receive.] No. A method is only a code block. If it is a class interface, it determines that its object can receive the message. Help method means that private method is not an interface.
[The action that calls a method like this is usually called "send a message to an object "]. Like
2.5.1 parameter list
2.6 construct the visibility name visibility egg of the Java program 2.6.1 name. The title should be "namespace ". The visibility of the name is reminiscent of the variable's
Visibility and variable hiding. 2.6.2 using other components is originally import2.6.3 static keyword 2.7. Our first Java program is introduced here
View JDK documentation. 2.8 comments and embedded documents
In general, this chapter is relatively simple.