Simple Introduction
Still remember to learn C + + ideal----Development game plug-in, remember that the first game developed in the university plug-in is repeatedly read, read the address data, and then algorithm matching, simulated click event, at that time by many students envy jealousy.
Java development was developed in March 2012 after the development of Android Focus, Java learning is completed in the university, when the Java exam 95 full of Java is not difficult. Later engaged in Android development found that their understanding of Java is not deep.
Content
Java Essentials
Points |
Defined |
Descriptive narrative |
Basic data types |
1, Byte (8) 2, shot (16) 3, int (32) 4, Long (64) 5, Float (32) 6, double (62) 7, char (16) 8, Boolean (1) |
|
Holding objects |
Collection (interface) ->list (sub-interface sequencing can be repeated) &NBSP ->linkedlist (linked list is not synchronized thread insecure) ->arraylist (array out-of-sync thread insecure)  &NBSP ->vector (array synchronization thread safety) &NB Sp &NBSP ->stack ->set (sub-interfaces receive only one internal sort) ->hashset Linkedhashset ->treeset Map (interface key value) ->hashtable (synchronous security) ->linkedhashmap (non-sync insecure) & nbsp ->weakhashmap ->treemap ->identifyhashmap |
Collection is a collection of objects. Collection has two sub-interfaces List and Set List can be obtained by subscript (.) To get the value, the value can be repeated Set can only use cursors to fetch values. And the value cannot be repeated. ArrayList, Vector, LinkedList is the implementation class for List ArrayList is thread insecure, Vector is thread-safe, and these two classes are implemented by arrays LinkedList is not thread-safe. The underlying is implemented by a linked list Map is a set of key-value pairs HashTable and HASHMAP are the implementation classes of MAP HashTable is thread-safe and cannot store null values HASHMAP is not thread-safe and can store null values |
Generic type |
The type of the parameter, which means that the data type being manipulated is specified as a parameter. Such parameter types can be used in the creation of classes, interfaces, and methods, respectively, as generic classes, generic interfaces, and generic methods. The advantage of introducing generics into the Java language is that it is safe and easy. |
The corresponding C + + is the module |
I/O system |
Java I/O is the input and output operation of Java |
Abstract classes InputStream and OutputStream are the base classes of all byte streams, which provide the basic interfaces for input and output processing, respectively, and implement some of these methods. Because InputStream and OutputStream are abstract classes, Therefore, you cannot create their objects directly. The methods provided in the InputStream class are: reading data from the stream, closing the stream and releasing the system resources associated with the stream and using the tokens in the input stream. The main methods provided in the OutputStream class are: output data, update output stream and close stream, etc. The classes involved: The byte input stream contains FileInputStream, Bufferedinputstream, and Dateinputstream. The corresponding byte output stream contains FileOutputStream, Bufferedoutputstream, and Dateoutputstream. |
Garbage collector |
One of the three important modules of the Java Virtual Machine (JVM) (the other two are the interpreter and multithreading mechanism). |
Through the garbage collector (garbage Collection. GC) proactively manages the recovery of memory. Program apes do not need to invoke functions to free memory. |
Order of initialization |
1. Static members 2. Static function 3. Static Zone 4. Other |
|
Reference |
The primary variable type has only one storage space (allocated in the stack), whereas the reference type has two storage spaces (one in the stack, the other in the heap), and the value Pass (reference) of the method parameter refers to the memory (heap) in which the parameters are referenced and the arguments are passed in to the same value; |
is Java a value or a pass-through reference? The base type is a pass-through value |
Concurrent |
Multi-process programming |
Java provides the underlying coordination mechanism to control access to shared resources. The coordination here consists of competition, cooperation and communication. Competition: Synchronized, lock Cooperation: Notifyall, interrupt, Signalall Communication: Pipedreader/pipedwriter |
|
|
|
C + + Essentials
Points |
Defined |
Descriptive narrative |
typedef and # define |
typedef is used to declare type aliases, and it is often used to add code readability in the actual writing process.
#define是一个宏定义命令, used to define a constant (including non-constant and constant), which itself is not run during the compilation process, but is completed in the preprocessing phase, so no matter what the correctness of the check, just do not have the meaning of the string substitution. |
|
Pointer/smart pointer |
The pointer is an indicator that tells the program which area of the memory is available to find the data. |
The smart pointer is actually a stack object, not a pointer type, and at the end of the life of the stack object, the smart pointer releases the heap memory it manages through the destructor. Std::auto_ptr, Boost::scoped_ptr, Boost::shared_ptr, Boost::scoped_array, Boost::shared_array, Boost::weak_ptr, Boost:: Intrusive_ptr.
|
Templates and generics |
Generic programming is to write code in a way that is independent of whatever particular type. Templates are the basis for generic programming. |
|
STL container |
Standard STL sequence Container: Vector, String, deque, and list. Standard STL Associative containers: Set, Multiset, map, and Multimap. Non-standard sequence containers slist and rope. Slist is a one-way linked list, rope is essentially a "heavy" string. Non-standard associative containers hash_set, Hase_multiset, Hash_map, and Hash_multimap. |
|
Thread pool |
The role of the thread pool is to effectively reduce the additional overhead associated with frequent creation of destruction threads. |
|
|
|
|
The difference between C + + and Java
Points |
Defined |
Descriptive narrative |
Java No pointers |
|
|
Java does not support header files, Java does not support macro definitions |
|
|
Java is run in the JVM, and is compiled into the JVM to recognize the loaded. class, not completely compiled into a computer directly run programs, C + + programs directly can be run on the computer. |
|
|
There are class references in both C + + and Java, which are to be clearly noted in C + +. The dominant. And in Java it's invisible. |
|
|
Java assigns a fixed length to each type of data. |
|
|
Type conversions are different |
In C and C + +, arbitrary type conversions can be done with pointers, often resulting in insecurity, whereas in Java, the runtime system handles object processing with type-compatibility checks to prevent unsafe conversions. |
|
Processing of structures and unions |
In C and C + +, all members of the struct and Union are public, which poses a security problem, and in Java there is no structure or union at all, and all the content is encapsulated in the class |
|
Java is used at the top. C + + in middleware and the underlying |
|
|
Garbage collection. C + + uses destructors to recycle garbage. Java proactively recycles itself |
|
|
Java objects are allocated from the heap, and C + + 's own active variables are allocated from the stack |
|
|
Summarize
Again, C + + and Java review points. The understanding of Java, C + + is more profound.
C + + Java Essentials record