JAVA senior pen interview questions

Java class (10 questions)
1, object-oriented features which aspects  
1. Abstract:
Abstract is to ignore those aspects of a topic unrelated to the current target, in order to more fully attention-related aspects of the current target. Abstract does not intend to understand all the problems, but only select some of them, being not part of the details. Abstract includes two aspects, one procedural abstraction, and second, data abstraction.
2. Inheritance:
Inheritance is linked hierarchical model class, and to allow and encourage the reuse of classes, it provides a clearly stated in common. A new class of objects can be derived from existing classes, this process is called class inheritance. The new class inherits the properties of the original class, the new class known as the original class of the derived class (subclass), while the original class is called the base class for the new class (parent class). A derived class can inherit methods and instance variables from its base class, and the class may modify or add new method makes it more suitable for particular needs.
3. Package:
package data and is surrounded by the process, access to the data only through a defined interface. Object-oriented computing began in the basic notion that the real world can be represented as a series of fully autonomous, encapsulated objects that access other objects through a protected interface.
4. Polymorphism:
polymorphism refers to allow objects of different classes respond to the same message. Polymorphisms include parametric polymorphism containing polymorphism. Polymorphism flexible language, abstract, behavior sharing, code-sharing advantages of a good solution to the problem of the application function of the same name.

2, say ArrayList, Vector, and storage performance characteristics LinkedList
ArrayList and Vector data is stored using an array, the array element number is greater than the actual data is stored so as to increase and insert elements, which allow the element directly indexed by serial number, but insert element array elements involved moving other memory operations, the index data fast and slow insert data, Vector since a synchronized method (thread-safe), typically on the performance than ArrayList difference, and LinkedList bidirectional linked list implementation stored, indexed by serial number data before the need to traverse to or after, but only before and after the record of this can insert the data item, the insertion speed.

3, whether Constructor constructor can be override?
Constructor constructor can not be inherited and can not rewrite Overriding, but can be overridden Overloading.

4, String s = new String ( "xyz"); created several String Object
two

5. What is the basic principle is that the garbage collector? The garbage collector can immediately reclaim memory? Is there any way the initiative to inform the virtual machine garbage collection?
Java language in a notable feature is the introduction of garbage collection mechanism to enable c ++ programmers the most headache solved the problem of memory management, which allows Java programmers in the preparation of the program no longer need to consider memory management. Because there is a garbage collection mechanism, Java objects are no longer in the "scope" concept, and only the object reference have no "scope." Garbage collection can effectively prevent memory leaks, efficient use of memory can be used. Garbage collector is usually as a separate low-level thread to run, heap memory have died a long time without the use of a clear and recovery under unpredictable circumstances, the programmer can not be called real-time garbage collector for a All objects or objects for garbage collection. Recovery mechanisms have a generation copy garbage collection and marking garbage collection, incremental garbage collection.

6, Spring abnormal global process in several ways, one of which include
using treated @ExceptionHandler

1. Create a base exception class declaration using @ExceptionHandler exception handling
BusinessException SystemException and custom exception classes, as follows:
Package com.twosnail.exception;
Import the javax.servlet.http.HttpServletRequest;
Import org.springframework.stereotype.Controller;
org.springframework.web.bind.annotation.ExceptionHandler Import;
@Controllerpublic class BasicExController {
/ * ** exception handler base class based @ExceptionHandler @return * * / @ExceptionHandler
public String exception (the HttpServletRequest Request, exception EX) {
// The different steering error different pages
IF (EX BusinessException the instanceof) {
return "Business-error";
} the else IF (EX SystemException the instanceof) {
return "error-System";
} the else {
return "error";
}
}
}

2. Controller requires all inherit such an exception process, as follows:
public class {} DemoController the extends BasicExController
However, Dao layer, layer-Service, the thrown exception Controller layer (BusinessException, SystemException other anomalies) can accurately display pages defined exception handling, reached the target unified exception handling.

Two, SimpleMappingExceptionResolver simple exception handler

7, List <Map <String, String >> ordering, in accordance with the requirements can be positive, the reverse order (to write the code can be written principles)
List itself is a collection of ordered arrays

//正序
for(int i=0;i<list.length;i++)
{ list[i] }
for(int i=list.length;i>0;i–)
{ list[i] }

8. A method for obtaining a Bean and call this method, for example, the following nameBean, how to obtain the method setName and call it, using Java reflection principle
public class nameBean {
public String name;
public String getName () {
return name;
}
void the setName public (String name) {
= this.name name;
}
}

import java.lang.reflect.method;
public class Test {
public static void main(String args[]) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, InstantiationException, SecurityException, NoSuchmethodException
{
Class NameBean c = NameBean.class;
method m = c.getDeclaredmethod("setName ", String.class); m.setAccessible(true);
NameBean nb = c.newInstance();
m.invoke(nb, “Hello”);
}
}

9. How can I add maven central repository with no jar package, how to deal with his son works
address local setting.xml configured central warehouse user name. Deploy command with the upload. Or upload nexus with the management tools nexus maven central warehouse.

10, java backend how to prevent network attacks, to name a few
a) verify the integrity and security of the rear end of the data
2) the use of bidirectional data transmission SSL confidentiality

UNIX, LINUX (10 questions)
a fill in the blank:
1. There are two flow control methods, one hardware embodiment, using (RS232) interface which allows the CTS signal transmission line, i.e., the RTS request to send signal line; the second is a software manner using flow control characters (Xon and Xoff).
2. The virtual terminal, a PC, through (network) connected to the UNIX host, the client runtime (Telnet) program, running on the server (the telnetd) program, as a virtual terminal UNIX-based TCP communication.
3. The kernel is divided into four sub-process management system, memory management, I / O management system and document management systems.
4. The difference between the process and its application in the basic state dynamics, the dynamic generation and termination, from the generation termination process may have as: the operating mode, and the waiting state ready state (blocking state). .
5. For the transmission of packets 10 communicates with the host abc.tuu.edu.cn test packets of commands and parameters to be used are (of ping abc.tuu.edu.cn -C 10.
)

Second, multiple-choice questions:

1. listed below list files command ls -al, (D) the file is a symbolic link file.
-Rw-rw--RW A. 2 HEL-S Users On Sep 09 11:05 56 is Hello
B. -rwxrwxrwx 2 HEL-S Users On Sep 09 11:05 56 is goodbey
C. drwxr-r--. 1 HEL Users On Sep 10 1024 Zhang 08:10
D. lrwxr Users 2024 of HEL-r--. 1 08:12 On Sep 12 is Cheng

2. There is a document file, using (D) may be implemented in the background Run at / home / stud1 / wang directory, the contents of the command file is output to the file file.copy file.
CAT File A.>; File.Copy B. CAT>; File.Copy
C. D. & File.Copy CAT CAT File File> & File.Copy

3. The following network protocol, the protocol is connection-oriented (A).
A transmission control protocol User Datagram Protocol B C D Internet Protocol Internet Control Message Protocol
Linux file permissions total of 10 bit length, is divided into four segments, represents the third paragraph ().
A file permissions of the file owner type B
C file owner's group permission to D other user's permissions

4. discovered when a host connected to the LAN network host ping command within the network can be in conjunction with, but not in communication with the public network, the problem may be (C)
A set incorrectly IP host
B is not connected to the LAN provided gateway
gateway or host C-LAN gateway is set incorrectly
D LAN DNS server settings are incorrect

The following file, the file containing the host name to IP address mapping relationship is (B).
A / etc / HOSTNAME B / etc / hosts C /etc/resolv.conf D / etc / networks

Operation and maintenance (5 questions)
1. Do you want to get a MAC IP 192.168.1.2 in the LAN, how to operate in XP system command prompt?

In the CMD command line -a 192.168.1.2 nbtstat

2.ICMP in communication, mainly to allow the machine through different categories (Type) and the Code (Code) to identify different connection status, what type 8 Name (D), meaning represents ()
ICMP is " Internet control message protocol "(Internet control message protocol) acronym, for passing control messages between IP hosts, routers
  Echo request Echo Reply message in response to the request is a response message.
  Timestamp Replay This message is purely a response with the Timestamp Request
  Timestamp Request ask for message transmission time required to calculate the difference in time to meet the routing synchronization agreements
  Redirect to redirect routing path

What is 3.ISO / OSI 7-layer model and the TCP / IP four-layer protocol? Between them and draw simple correspondence between each operation and each protocol
 ISO / OSI TCP / IP protocol
  physical layer data link layer network layer transport layer session layer denotes an application layer
  network interface layer, internetwork layer, transport layer application
4. how to view the usage capacity of the system partition? how to view the used capacity / var / log directory?

df –h
  du –sh /var/log
  cat /dev/null >/var/log/messages

5. [root @ Seker root] # RPM -qa | grep sendmail
  sendmail-8.12.11-4.RHEL3.1
  [root @ Seker root] # RPM -e sendmail-8.12.11-4.RHEL3.1
  error: Failed Dependencies:
  / usr / sbin / IS needed by the sendmail (Installed) RedHat-LSB-1.3-3.1.EL3.centos.0
  smtpdaemon needed by IS (Installed) the mdadm-1.5.0-9
  [the root @ Seker the root] #
-e uninstall the specified parameter is the rpm package, as implied Why can not uninstall? how can I uninstall?
RedHat-lsb-1.3-3.1.EL3.centos.0 and mdadm-1.5.0-9 need sendmail-8.12.11-4.RHEL3.1 package, so, before you remove the sendmail-8.12.11-4.RHEL3.1, first delete the previous two packages

Published 40 original articles · won praise 53 · views 7715

Guess you like

Origin blog.csdn.net/qq_44758351/article/details/104184667