1.java Pros and cons
Pros: Pure Face object, cross-platform, provide many built-in class library, support web development, have good robustness and security
Cons: Slow, cross-platform not as close to the operating system as other languages, complex
2.java vs. C + +
Are all in the face of object language. Java is an explanatory language (a compilation is used permanently), C is a compiled language, Java does not have pointers, does not support multiple inheritance, does not require developers to allocate memory, Java cross-platform
3.public static void Main (String "args") is the entry function for Java, but it is not the first to run the function.
Scopes in 4.java have global variables, local variables
Public all classes and objects can be accessed
Protected the same package and subclass can access
Private Only You can access
Default can only be accessed in the same package
5. A Java file can have more than one class, but only a public-decorated class
6. Constructor, same as class name, call at new, complete class initialization, can have multiple, can have no parameters, cannot inherit and overwrite, can be overloaded, super can call
7. In order to overcome the multiple inheritance is not supported, with the interface (the collection of abstract classes)
8.clone creates a same class without affecting the original class
9. The reflection mechanism is the Java language allows the program to self-check, and also allows internal members to be checked, you can dynamically create the object of the class
10.package--(1) Resolving naming conflict issues (2) makes the project more structured and readable
11. Implement pointer function via DLL (System dynamic link library) callback function
12. In the face of the object is to encapsulate the data and methods together, as an interdependent whole, the face of the process is event-centric, progressive implementation
13. Abstract Inheritance Encapsulation polymorphism
14. Face the advantages of object development: high efficiency and robustness, good maintainability
15. Inheritance (Subclass calls the parent class's member variables and methods) combination (The new class creates an object of the original class and reuses the existing functionality)
16. Overloading (similar to the same name method, different parameters) and overwrite (subclass, same name with same parameter)-polymorphic
17. Abstract classes and interfaces
Same point: Cannot instantiate only if an interface is implemented or an abstract class can be instantiated
Different points: interfaces can only be defined, not implemented, and abstractions can be defined as member variables that implement interface definitions default to public static final
18. Obtain the class name of the parent class GetClass (). GetName ()
19.this point to current instance object super can access Fred method or member variable
20. Identifiers can only be composed of characters, numbers, underscores, and $, and cannot begin with a number
21.breake jumps out of the current loop continue stops the current loop return method so that the program returns to the Java runtime system
22.final declared property immutable method non-overridden class cannot be inherited
Finally the Trycatch is executed before return
Finalize is a function that garbage collection mechanism calls to reclaim objects
23.assert software debugging method, code correctness check mechanism
A 24.static defined variable is a method defined by a global variable only if the object is created can only be executed once with the code block
25.Switch (expr) expr can be a byte short char int
26.volatile modified variables are placed in the buffer to improve code efficiency, variable values change the cache value unchanged
27.instanceof checks if an object is a class
28.STRICTFP Precision Arithmetic floating point
29. Basic data type Byte int short long double char Boolean float
30. Immutable classes, once created non-modifiable
31. Value passing pass value, reference passing is delivery address
32. Data type conversion low to Dayne conversion byte "short" char "int" long "float" double
High to low strong conversion
33.round rounding ceil up and rounding down
34.i++ the first assignment after the Operation ++i the first operation and then assigns the value
35.char Store a Chinese with two characters, English only with one
36. String creation is new and is of different address
37. "= =" comparison address equals straight hashcode (no rewrite Hashcode method will never be the same)
38.String immutable class, once created cannot be changed
StringBuffer variable class, safe
Stringbilder variable class, unsafe, encounter all character buffers
StringTokenizer is a tool class for string splitting
39. Array is object, int[] a=new int[] int[] a={1,2}; int[] a a=new int[]{1,2}
40.length Take number leader Length () Take string length
41. Check for exceptions exception can be avoided in the code
42.InputStream and OutputStream One-character units Reader and writer are in bytes (no cache is used)
43java sockets are used to communicate with a virtual machine or a different computer
44. Non-blocking IO (NIO) is a non-blocking IO operation via selector channel and buffer
45.java serialization means that the state of the object is written in the stream to transmit or save the file when communicating.
46. Explain the three steps of execution: code loading code Checksum code execution
47.GC is a garbage collection mechanism
48. Memory leaks: Objects that are no longer in use consume memory for a long time and are not released
Workaround: Implement the Equals and Hascode methods of the key class.
49. Heap: Storing objects created at run time
Stacks: Storing basic types and reference variables
50.Collections class with a large collection of interfaces "list (save in order) set (element not repeatable) map (save key value pair ()"
List (linkedlist bidirectional list ArrayList vector synchronized with different steps)
Map (HashMap, unsafe weakmap identityhahmap) *key non-repeatable
Collection is a collection interface
51. iterators, traversing and selecting objects in a sequence
JAVA Written test notes