Java static, this, super, final usage
I. Static
Take a look at the following program:
Public class Hello {Public static void main (string [] ARGs) {// (1)System. Out. println ("Hello, world! "); // (2)}}
I have read this program,
I. FinalAccording to the context of the program, the Java keyword final has the meaning of "This cannot be changed" or "final state". It can modify non-abstract classes, non-abstract class member methods, and variables. You may need to block changes
1. Basic data type
Integer:
1 byte
Short 2 bytes
Int 4 bytes
Long 8 bytes
Character:
Char 2 bytes
Floating point:
Float 4 bytes
Double 8 bytes
Boolean:
Boolean 1 byte
2. added a binary integer in java 7.
Starting with 0 B or 0 B
3. A 16-bit Unicode
Keyword explanation in Java
1. Final
Final keyword modifier member variable
You can define a member variable as final, but such a member variable must be initialized when constructing an object. That is to say, after each constructor is executed,
See android2.2
When using the SDK source code, you can see this code in memoryfile. Java: Private Final Boolean mownsregion;
// False if this is a ref to an existing ashmem region its constructor is: Public memoryfile (string name, int length)
Many technologies will be learned in the big data learning process, but Scala is undoubtedly essential. How can we quickly understand Scala in the big data technology learning process, I want to learn more about this and thank you for the detailed
1. Interface improvementA. Static methods can be defined in an interfaceB. More importantly, the method in the interface can be modified with the default, adding a method body2. Why can't I use the default method to override the
Compared to the lock and volatile described earlier, the read and write to the final domain is more like normal variable access. For the final domain, the compiler and processor are subject to two reordering rules:
Writing to a final field
These days in the Java game, are all about the basics of Java basic things, here to tidy up:Java is a language that distinguishes the case of letters (case-sensitive) and the naming conventions for packages, classes, variables, and so on in the Java
The final keyword can be used to modify basic variables, and references can also be used to modify methods and classes. There are different meanings when modifying different objects, so it is easy to confuse them and make a summary here.
First, the outset
This blog from: http://www.cnblogs.com/yuananyun/
The final modifier is a relatively simple and commonly used modifier in Java, and a modifier that is more "misunderstood". For many Java programmers, most
Zen House Moon (Http://www.cnblogs.com/yaoyinglong)Java promises a good promise to programmers: without caring about memory recycling, Java provides an excellent garbage collection mechanism to reclaim already allocated memory.So beginners tend to
Use the final keyword to do the following:. declaring a classWhen you use final to decorate a class, the class cannot be inheritedFinal class Example{int Value;public int getValue () {return value;}} The test here wants to inherit example, but
This article transferred from: http://www.infoq.com/cn/articles/java-memory-model-6Compared to the lock and volatile described earlier, the read and write to the final domain is more like normal variable access. For the final domain, the compiler
Accumulation of knowledge points
1. About abstract classes and interfaces:
The class cannot be multi-inherited and the interface can be;
Abstract classes and
object class: 11 methods: First class method: ToString, equals, hashcode; the second type of method: Clone, Finalize, GetClass; Third class method: 3 Wait, notify, Notifyall; method: ToString: Used to describe information
One, abstract class: Abstract
1, as long as there is one or more abstract methods of the class, must be declared abstract as an abstraction class;
2, the abstract class can have specific implementation methods;
3, there can be no abstract method
Java internal classes and their instantiationIn Java, it is allowed to define another class within a class (or method, statement block), called an inner class (Inner Class), sometimes called a nested class (Nested Class).
There is a logical
When declaring properties, methods, and classes in Java, you can decorate them with the final keyword. The final variable is a constant and can only be assigned one time; The final method cannot be overridden by a quilt; the final class cannot be
The problem is seen in stack Overflow.
Rule If you have initialized a final variable, then your cannot change it to refer to a different object.
Final classes cannot be subclassedFinal methods cannot be overridden. (this are in
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.