Learning Basics: Acmer, C + + Foundation
The 10th edition of "Java Language Programming (Basic)" is a reference (thanks to YJJ's recommendation), listing some of the points of knowledge, and paying attention to the reasons behind and the pros and cons of thinking.
"Chapter 14-16-Chapters on visual programming" Skip
"17 chapters--io and profound" continuous learning
"Appendix Adhi" is a relatively practical appendix
For foreach, get the value is not a reference. That is, the Vals does not change after the following operations:
for (Integer val:vals) { val + = 1;}
(Page 10)
There are three versions of Java:
Java Standard Edition (Java standards Edition, Java SE) can be used to develop client-side applications. Applications can run independently or as applets in a Web browser.
Java Enterprise Edition (Java Enterprises Edition, Java EE) can be used to develop server-side applications, such as Java servlet and JavaServer Pages (JSP), and JavaServer Faces (JSF).
Java Micro Edition (Java Micro Edition, Java ME) applications for developing mobile devices, such as mobile phones.
(Page 42)
To improve readability, Java allows for the use of underscores between two digits of a direct amount of value. Such as
Integer million = 1_000_000;
(Page 104)
In a Java program, all classes in the Java.lang package are implicitly imported.
(Page 142)
Input redirection and output redirection
Java Demo < Input.txt > output.txt
(Page 224)
Parameters with the same type of variable length can be passed to the function and treated as an array.
In a method declaration, the specified type is followed by an ellipsis (...). )。 You can only specify a variable-length parameter in a method, and the parameter must be the last parameter. Such as
public static void Printmax (double ... numbers) {}
(Page 244)
The lines of the jagged array (ragged array) can vary in length. Such as
Integer[][] arr = { {1, 2, 3} , {1, 2} , {1}};
(Page 288)
Typically, an instance-independent variable or method is declared static, and the variable or method associated with the instance is declared non-static.
(Page 290)
To prevent users from creating instances of the class, you can set the construction method to private.
(Page 303)
The keyword this can be used to call another constructor method of the same class. Such as:
public class Circle { private Double radius; Public Circle (Double radius) { This.radius = radius; } Public Circle () {This (1.0); }}
Java requires that in the constructor method, the statement this (the argument list) should appear before any other executable statement.
If a class has multiple construction methods, it is best to implement them using this (parameter list) whenever possible. In general, construction methods that have no parameters or fewer parameters can invoke the constructor of the parameter with this (parameter list). Doing so often simplifies the code, making the class easy to read and maintain.
(Page 328)
Instances of classes such as Integer, Double, string, etc. are immutable.
Note the following output evaluates to False and true
String S1 = "Hello"; String s2 = new String ("Hello"); String s3 = "Hello"; System.out.println (S1 = = s2); System.out.ptintln (S1 = = S3);
(Page 333)
StringBuffer and StringBuilder are similar to the string class, except that the string class is immutable.
The StringBuffer is synchronous, and StringBuilder is asynchronous.
(Page 354)
To invoke the parent class constructor, you must use the keyword super, and the call must be the first statement of the constructor. If you do not explicitly call super, the compiler automatically takes super (); As the first statement of the constructor.
(Page 364)
A instanceof B is used to determine if variable A is an instance of Class B.
(Page 377)
Subclasses can override the protected function of the parent class and change the visibility to public. However, subclasses cannot weaken the accessibility of functions defined by the parent class. For example, a function is defined as public in the parent class and must also be defined as public in the subclass.
(Page 379)
polymorphic: Object obj = new Apple ();
Dynamic binding: When an instance function is called from a reference variable, the actual type of the variable determines which implementation of the method is used at run time
(Page 400)
The finally block executes even if there is a return statement before the finally block is reached.
(Page 409)
JDK 7 provides the following new try-with-resources syntax to automatically close the file. The resource must be a autocloseable subtype, such as PrintWriter, with a close () function. The Declaration and creation of the resource must be in the same line statement.
Try ( printwriter printwriter = new PrintWriter (file);) { printwriter.println ("Hello, QQ");}
(Page 428)
Abstract functions are non-static. You cannot use the new operation to create an instance from an abstract class.
(Page 436)
All the data fields in the interface are public static final and all functions are public abstract, so Java allows these modifiers to be ignored.
(Page 442)
For protected native Object clone () throws Clonenotsupportedexception;
The keyword native indicates that the function is not written in Java, but it is implemented by the JVM against its own platform.
Java Basics Review