of the empty argument, but also the custom constructor, not the default constructor.9) If the class declares a constructor, the Java compiler will no longer provide a default constructor. If you do not manually write the parameterless constructor, but call the parameterless constructor, will be an error!10) constructors can be overloaded and overloaded for convenience, and overloading rules are the same as
Java abstract classes and interfaces
1. Grammatical differences
There is a significant grammatical difference between an interface and an abstract class:
(1) member variables
The interface has no variables, and the members defined in the interface are public constants, which are publicly, final, static, and are automatically added even if no identity is displ
changes to variables are ordered. For the volatile variable to provide ideal thread safety, the following two conditions must be met:1, the write operation to the variable does not depend on the current value.2. The variable is not included in the invariant with other variables.Synchronized: Visibility is guaranteed to be orderly and atomic in nature. Implemented as followsVisibility: When a lock is released, changes to the shared variable are writte
Constant:A constant is an identifier whose value is constant during run time, and constants can only be referenced in the program and cannot be re-assigned.Naming rules for constants:1. In Java, adding the final keyword to a variable declaration represents a constant, and adding the static keyword represents a class variable. The General union declares a variable;2. Try to use the represented meaning intuit
All +All-
Thinking in Java
1. introducation to object
+ - object-oriented -- abstraction
1. You can regard all the conceptual components of the problem to be solved as an object.
2. Program is a group of objects that send messages to each other and tell the other party what to do. A message is a request that calls a me
In Java, all instance, static, and array elements are stored in heap memory, and heap memory is shared between threads. Local variables, method definition parameters, and exception handler parameters are not thread-Shared between them, they will not have memory visibility issues and are not affected by the memory model.Communication between Java threads is controlled by the
1. The file name of the source code must match the class name of the public class, and there can be at most one common class (public) in a source code file
2. NOTES: 3 kinds
Line comment with double slash//start
Paragraph comment/* Comment content */
Document Comments/** Comments */
3.8 Basic types of data type
Integer 4 types: Byte (1byte), short (2 bytes), int (4 bytes), Long (8 bytes) are signed (signed)
Basic data typesJava is the language of a strong data classThere are 8 basic data types, including:Integer 4 types Int (4 bytes) short (2 bytes) long (8 bytes) byte (1 bytes)The range and machine-independent lengths of integers in Java are certain, and do not cause integer overflow across platformsFloat type two double floatThe length of the double is twice times the length of the float, the double value bu
, except the highest bit represents the positive and negative sign of the bit, in the lowest bit will be with the actual data error, simply is we give the value, in In most cases it takes more than 64bit of digits to be accurately represented (even in the case of an infinite number of bits), whereas a double type has a value of only 64bit, and the number of digits behind it will definitely bring an error, and the result of "mathematically accurate" cannot be obtained.When using the BigDecimal (d
Start to learn Java, the first is the configuration of the Java programming environment, first download the JDK from the official website, installation, here to remind, it is best not to put in the C-disk, record the address of the storage, the environment needs to use the configuration. After the completion of the JDK installation, then download the Eclipse compiler
Panax Notoginseng , the following statement altogether created how many objects:strings= "a" + "B" + "C" + "D";Answer: For the following code:STRINGS1 = "a";STRINGS2 = S1 + "B";STRINGS3 = "a" + "B";SYSTEM.OUT.PRINTLN (s2== "AB");system.out.println (s3== "AB"); The first statement prints the result false The second statement prints the result of true javac compilation can be optimized for expressions that add directly to string constants without having to wait for the runtime
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.