• Java基础知识2


    1. Aspects of OO?

    a. Abstract

    b. Inheritance

    c. polymorphisms

    d. encapsulation

    2. The difference between RuntimeException and the common exception?

    a. Java complier require must declare the exception for non-RuntimeException, but don't need for RuntimeException

    b. RuntimeException means the VM always met exception which is a common error

    3. Difference between HashMap & Hashtable:

    a. HashMap: non-thread safe, allow empty key & empty value, new class in Java1.2, have containsValue & containsKey methods

    b. Hashtable: thread safe, don't allow empty key, old class in old jdk, have contains method

    4. Difference between Error & Exception?

    a. Error: it's difficult to backup, a serious issue, such as memory leak, crash. Program can't catch it

    b. Exception: the design or code issue, program can catch it

    5. When use synchronized, when use asychronous?

    a. When the data share in different thread. Such as when we write the data into a file, and it maybe read by other thread, we need to use synchronized to

    b. When a function/method need long time to execute, and we don't want to wait the function return, use async will be more efficient

    6. Different between head & stack

    a. Stack: Fist In First Out, quick, used to save valued type, such as primitive type

    b. Heap: is the group by stack, used to save the reference type, such as object

    7. Difference between Static Nested Class  & Inner Class(Unstatatic Nexted Class)

    a. Static don’t need instance, but inner need instance

    8. Different between JSP dynamic include and static include:

    a. 动态include用jsp:include动作实现:<jsp:include page="included.jsp" flush="true" />

    b. 静态include用include伪码代码:<%@ include file="included.htm" %>

    9. List the common runtime exception:

    a. ArthmeticException, ArrayStoreException, BufferOverflowException, BufferUnderflowException, CnnotRedoException, CannotUndoException, ClassCastException, CMMException, IllegalArgumentExcrption, IndexOutOfBoundsExcetpion, NullPointerException, NoSuchElementException, SystemException, SecurityException

    10. Describe database connection pool

    a. J2EE server will create solid number db connection pool, and it will be always more than the init number. When Client need to connect the db, pool driver will return a free pool connection to the client and mark the connection to busy. If there is no free connection, pool will create a solid number connections, the number decide by the configure. When the client finish the query use the connection, the pool driver will mark it as free and others can use this connection

    11. The elements of Set don't allow duplicate, how to make a distinguish whether the element is duplicate? Use == or equals? And what's the differences?

    a. Set use hasCode to differ element duplicate or not, use hasCode to judge whether the value is same, if is same, just do update operate, if no, add a new element for it.

    b. == used to judge whether primitive type is equal, equals used to judge whether the object value is same. The == cannot been overloaded, but equals can.

    12. HashCode(http://wenku.baidu.com/view/9070f05c312b3169a451a4af.html):

    a. 如果两个对象相同,那么他们一定要有相同的hashcode(用equals)

    b. 如果两个对象的hashCode相同,他们并不一定相同

    13. Java Exception Prototype & Application

    a. Java built-in syntax error check, such as the array index out of bounds exception, and invoke the null object will get NullPointerException

    b. Another is custom exception, programer can create their own exception class, and decide when throw the exception. All exception is the child class of java.lang.Throwable.

    14. The prototype of JVM load class

    a. JVM load class use ClassLoader and child class of it. Java ClassLoader is an important Java Runtime system component, it responsible for query and load class file.

    15. Whether char variable can save a chinese character? Why?

    a. Yes, it can, because java use unicode encoding, and a char have 16 byte.

    16. JSP built-in object & method:

    a. Request - javax.servlet.http.HttpServletRequestobject, request.getParameter, request.getAttribute, request.getSession

    b. Response - javax.servlet.http.HttpServletResponse object, response.getWriter, response.setContentType

    c. Session - javax.servlet.http.HttpSession

    d. Application - javax.servlet.ServletContext

    e. Page - page servlet instance

    f. Config - javax.servlet.ServletConfig

    g. Exception -

    h. PageContext - javax.servlet.jsp.PageContext

    i. Out - javax.jsp.jspWriter

    17. Thread basic conception, thread basic status and the relationship between the status

    a. For status: 运行,就绪,挂起,结束(run, ready, hang-up, end)

    18. JSP common directive

    a. <%@ page language="java" contentType="text/html;charset=GB2312" session="true" buffer="64kb" autoFlush="true" isThreadSafe="true" info="text" errorPage="error.jsp" isErrorPage="true" isELIgnored="true" pageEncoding="gb2312" import="java.sql.*" %>

    b. <%@ include file="filename" %>

    c. <%@ tablib prefix="c" uri="http://…" %>

    19. 条件操作符(&&, ||)和逻辑操作符(&, |, ^)的区别

    a. 逻辑操作符不会产生短路

    b. 条件操作符只能操作布尔型的,而逻辑操作不仅可以操作布尔型,而且可以操作数值型

    路慢慢其休远羲,吾将上下而求所
  • 相关阅读:
    mysql 查询缓存
    DevExpress 使用示例
    搜索营销推广学习资料
    mysql 导出表结构
    Google nexus one 获取root权限
    ASP.NET 使用Get方式请求WebService,并得到DataSet结果
    Iweboffice 2009 Winform版 Word文件的打开与保存
    【转】mysql 分析查找执行效率慢的SQL语句
    java.sql.BatchUpdateException: Lock wait timeout exceeded; try restarting transaction
    java 中job的core配置
  • 原文地址:https://www.cnblogs.com/garinzhang/p/2544180.html
Copyright © 2020-2023  润新知