), integers in two bytes; in 32-bit processors such as sun SPARC, integers are represented in 4 bytes. On Intel Pentium processors, integer types are determined by the specific operating system: for DOS and Win32, integers are 2 bytes, and for Windows 9x, NT, and 2000, integers are 4 bytes. Of course, performance is bound to drop after making the integer type platform irrelevant, but for Java, the cost is worth it.
1, final, finally, Finalize the difference between final: modifier (keyword) if a class is declared final, No child classes can be Inherited. therefore, A class cannot be declared abstract and declared Final. Declaring variables or methods as final ensures that they are not changed in Use. A variable declared final must be given an initial value at the time of declaration and cannot be modified Later. A method that is declared final can also be used o
Technorati Tag: java, generic, generic
Java generic applications are one of the core foundations of java and are introduced from java 5. If you have used java Collection before, you have already been familiar with generics. Using Generics in
1. Data Types and variables
The variable types in C ++ are similar to those in Java. Like Java, C ++ has int and double types. However, the value range of these numeric types depends on the machine. For example, on a 16-bit system, such as running DOS or Windows 3. on the PC of x, int Is Dual-byte (2-byte), and the value range is much smaller than that of Java's
Annotations (Annotation) are introduced in JAVA5, which provides a new way to add information to your code. Annotations combine metadata with source code files to some extent, as many mature frameworks (Spring) do. So, what exactly can annotations do?1, the role of annotations.
Provides information needed to fully describe a program, such as compile-time validator information.
Generates a descriptor file, or generates a definition for a n
tell developers where the problem has occurred.Ii. Exception System
1. Since the problem arises, it is necessary to solve the problem, just like a person is ill and the right remedy. java also gives us a series of exception handling classes. How should these classes be differentiated?
In general, there are two types of exceptions in java: one is Error and the ot
Thinking in JAVA notes-Chapter 1 Introduction to objects and thinking
This chapter introduces the basic concepts and principles of object-oriented
1.1 Abstraction
My understanding: Hiding complex and useless attributes, leaving what the program needs
1.2 each object has an Interface
Question: The concept of interfaces and implementations and why the interface mechanism is introduced (see the specific chapte
the classes are divided into different types: abstract and final classes, and so on. These will be described in the Access Control section.In addition to some of the types mentioned above, Java also has some special classes, such as: Inner class, anonymous class.Java PackagePackages are primarily used to classify classes and interfaces. When developing Java programs, you might write hundreds or thousands o
loaded.In addition to the constants generated at compile time, it is also possible to generate dynamically, such as The Intern () of the String class.1.7 Direct MemoryIn JDK 1.4, new NIO classes are added, which can be used to directly allocate out-of-heap memory (Native heap) using the Native Library, and then operate through a Directbytebuffer object stored in the Java heap as a reference to this memory.This can significantly improve performance in
1. Java Basic Data typeint 4 max 0x7fffffff 2147483647=2 31 square-1 first bit symbol bit minimum -2147483648 0x80000000 complement store first constant other bit reverse plus 1Short 2 max 2^15-1 32767 min -2^15-32768Long 8 maximum 2^63-1 minimum value -2^63BYTE
nothing else. It does not print Animal are equal :. How can it not print this string literal constant? After all, printing is correct! Because:+ The operator, whether used as an addition or a string join operation, has a higher priority than the = Operator.Therefore, the parameters of the println method are calculated as follows:
System. out. println ("Animals are equal:" + pig) = dog );
Of course, the value of this Boolean expression is false, which is the output of the program.
Dizzy Hello
Se
-language, understanding the class file format is helpful for us to learn other JVM-based languages.
In short, the class file is in the middle of the entire Java technical architecture, which plays an important role in understanding the entire system. :
Vc/J2bXExNq05r/release + 49sDgo6i78tXfvdO/release + release/release + DTprXEw + release + 6 jrCDL/release + release/uyv2 + 3ba809DL/release/b7dz + release /tbQ1by + response/tNf2Y2xhc3POxLz + yv2 + 3c/
-environment variables3.1.1 java_home=% Installation Path%\JAVA\JDK3.1.2 Path=%java_home%\binConfiguration of 3.2classpath3.2.1 Classpath=.; C:\;e:\Ps:1. If there is a semicolon at the end of the value of Classpath, the running class is not found in the specific path and will be found again by default in the current directory.2. If the value of classpath results in no semicolon, the running class is not fou
Consolidate one of the basics of JAVA-extensive explanation (1)
I. Introduction
1. What is generics? First, let us know that ArrayList is generics. What unexpected functions can ArrayList accomplish? Let's take a look at the following code:
ArrayList
strList = new ArrayList
();ArrayList
intList = new ArrayList
();ArrayList
Step1:myProgram.java source files using Notepad editingThe Step2:compiler compiler uses the JAVAC commandGenerate Myprogram.class Bytecode filesStep3. Interpreter interpreter using Java commandsExplain the running programExample:Add a text file to a path and rename it to Helloworld.java, for example: E:\android\code\HelloWorld.javaEdit the file with Notepad and e
Java Learning Path (1), tools
I. JDK (Java Development Kit)
JDK is the core of the entire Java, including the Java Runtime Environment (Java Runtime Envirnment), a bunch of Java tools a
of variables are in the method, and the variables are automatically destroyed when the method ends.
Member variables: Member variables are variables that are defined in the class, outside the method body. This variable is instantiated (allocating memory) when the object is created. Member variables can be accessed by methods in the class and statements of a particular class.
Class variables: Class variables are also declared in the class, outside the method body, but must be declared as
return type. A method that does not return a value silently returns control to its callerString[] args: Indicates that the parameter of the main method is an array of type string, with the parameter named args. can be written in other forms: string args[] or string ... argsPackage and Import://Refer to the Java API CHM documentationClasses are grouped by packageThe import statement tells Java which package
Stackoverflowerror and OutOfMemoryError like the virtual machine stackThe fourth one is the Java heap:Created when the virtual machine is started, with the sole purpose of storing the object instance. Almost all of the object instances are allocated memory here. The Java heap is the primary area of garbage collection management. So the Java heap is also called t
value) are transmitted regardless of native data type or referenced data type) if the passed parameter is a reference type, it is only the address of the object that is passed
(3) What type of reference can point to what type of object. For example, a reference of the people type can point to an object of the People type, but cannot point to another object. For example, a reference of the People type can point to an object of the bird type.
People people = new People (); // correct
10 Construc
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.