Niuke.com Wrong Question Collection 10

1. The data field can be a basic type variable or an object

2.char[]ch = new char[3];//default space

int []Int=new int[2];//default 0

String[]strings = new String[2];//default null

3. The default of the integer type is the int type, and the default of the decimal type is the double type

4.Swing is a new graphical interface system built on the basis of AWT. It provides all the functions that AWT can provide, and greatly expands the functions of AWT with pure Java code. AWT is a C/C++ program based on native methods, and its running speed is relatively fast; Swing is a Java program based on AWT, and its running speed is relatively slow.

5.

 1. Compare the basic type and the basic package type with the "==" operator. The basic package type will be automatically unboxed to the basic type and then compared, so Integer(0) will be automatically unboxed to the int type and then compared. Compare, obviously return true; 

         int a = 220; 

         Integer b = 220; 

        System.out.println(a==b);//true
2. Two Integer types are compared "==", if its value is in - 128 to 127, then return true, otherwise return false, which is related to the buffer object of Integer.valueOf(), and will not be repeated here. 

        Integer c=3; 

        Integer h=3; 

        Integer e=321; 

        Integer f=321; 

        System.out.println(c==h);//true 

        System.out.println(e==f);//false 

      If the Integer is new, it is directly false. Because the new one will not refer to the existing cache object

3. Compare the two basic package types with equals(). First, equals() will compare the types. If the types are the same, continue to compare the values. If the values ​​are the same, return true. 

        Integer a=1; 

        Integer b=2; 

        Integer c=3; 

        System.out.println(c.equals(a+b));//true 

4. The basic package type calls equals(), but the parameter is the basic type , at this time, automatic boxing will be performed first, the basic type will be converted to its encapsulation type, and then the comparison in 3 will be performed.  

        int i=1; 

        int j = 2; 

        Integer c=3; 

        System.out.println(c.equals(i+j));//true 
The "==" operation of the wrapper class does not automatically unbox without encountering an arithmetic operation The 

equals() method of the wrapper class does not handle data conversion 


6.

 grep: The grep command in Linux is a powerful text search tool that uses regular expressions to search for text and print out the matching lines. The full name of grep is Global Regular Expr ession Print, which represents the global regular expression version, and its use rights are all users. 

-E means use the extended expression 

^: match the beginning of the regular expression. 

$: Matches the end line of the regular expression. 

7.


Communication between unix processes 

(1) Pipe (Pipe): Pipes can be used for communication between processes with affinity, allowing a process to communicate with another process that has a common ancestor with it. 
(2) Named pipe: Named pipe overcomes the limitation that pipes do not have names. Therefore, in addition to the functions of pipes, it also allows communication between unrelated processes. Named pipes have corresponding file names in the file system. Named pipes are created by the command mkfifo or the system call mkfifo. 
(3) Signal (Signal): Signal is a relatively complex communication method, which is used to notify the receiving process that some event has occurred. In addition to being used for inter-process communication, the process can also send signals to the process itself; in addition to supporting Unix early signals In addition to the semantic function sigal, it also supports the signal function sigaction whose semantics conform to the Posix.1 standard (in fact, this function is based on BSD. In order to achieve a reliable signal mechanism, BSD can unify the external interface and re-implement the signal function with the sigaction function) . 
(4) Message queue: The message queue is a linked list of messages, including the Posix message queue system V message queue. Processes with sufficient permissions can add messages to the queue, and processes granted read permissions can read messages from the queue. The message queue overcomes the shortcomings of the signal carrying the small amount of information, the pipeline can only carry the unformatted byte stream and the buffer size is limited 
(5) Shared memory: allows multiple processes to access the same memory space, which is the fastest available IPC form. It is designed for the inefficient operation of other communication mechanisms. It is often used in conjunction with other communication mechanisms, such as semaphores, to achieve synchronization and mutual exclusion between processes. 
(6) Mapped memory: Memory mapping allows communication between any number of processes. Each process using this mechanism implements it by mapping a shared file into its own process address space. 
(7) Semaphore (semaphore): It is mainly used as a means of synchronization between processes and between different threads of the same process. 
(8) Socket: A more general inter-process communication mechanism, which can be used for inter-process communication between different machines. Originally developed by the BSD fork of Unix systems, it is now generally portable to other Unix-like systems: both Linux and System V variants support sockets.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325726677&siteId=291194637