java interview questions - basic part (1)

{} {} $ With the difference

  1. # {} Is precompiled sql
  2. Alternatively $ {} string, i.e. placeholder placeholder is used to replace the

MYSQL index, why the index, the advantages and disadvantages

1.mysql index is guaranteed to be unique advantage of data more quickly find the desired value.
2. The disadvantage is the low maintenance efficiency, increase the time to delete indexes also need to change

grop by and order by ----- What does it mean

  1. group by grouping is used, the polymerization must function with, for example, sum (), avg (), etc.
  2. is used to sort order by default in ascending order, ending desc home is in descending order.

SQL parameters in the limit

sql limit is used to set the number of returned e.g. select * from aa limit 0,1.0 from what represents the beginning, the number 1 indicates, is a data

SQL statement optimization

WHERE + ORDER BY + LIMIT
or
WHERE + ORDER BY (multi-column) + LIMIT

The jQuery selector

1. The selector element

$ ( "P") select all p tags
$ ( "p.intro"). Select all the class = "intro" p-label
$ ( "p # demo") selects all id = "demo" p-label,

2. attribute selector
$ ( "[href]") href attribute is an element selected
$ ( "[href! = Aa ]") is not equal to aa selected elements href

3.css selector
$ ( "p"). Css ( "background-color", "red") to the background color of all p tags to red.

JSP and differences servlet, and life cycle

compiling the servlet into a jsp after ( on the servlet jsp essentially, but only identify JVM java class can not recognize jsp code, web container code into jsp jvm java code can recognize ).
jsp page display better at, servlet is better at logic control.

servlet life cycle

  1. Initialization phase, calls the init () method.
  2. Corresponding client request phase, calls the servlet () method.
  3. End of life, calling destroy () method.

jsp life cycle ( in fact, and almost servlet )
jsp servlet must be converted, before they can request the service, so just a few more of the translation process

  1. Transformation
  2. Compile
  3. Loaded and instantiated
  4. Initialization, call jspinit () method,
  5. User response phase, calling jspservlet ().
  6. Time to end calls jspdestroy ().

mybatis in resultMap parameter configuration, how the output column, SQL language print

// such as maps visit to the US Mission system I wrote in
<resultMap type="Shangjia" id="sj">
<result property="Sid" column="Sid"/>
<result property="Sc" column="Sc"/>
<result property="Sorimage" column="Sorimage"/>
<result property="Sname" column="Sname"/>
<result property="Pei" column="Pei"/>
<result property="Sphone" column="Sphone"/>
<collection property="cais" ofType="Scai">
<result property="Cid" column="Cid"/>
<result property="Cimage" column="Cimage"/>
<result property="Cname" column="Cname"/>
<result property="Cmoney" column="Cmoney"/>
<result property="Cmiao" column="Cmiao"/>
</collection>
</resultMap>

// many mapping, a business can have more food
property means that the name of the entity and the corresponding column is the name of the database field

As for print sql statement, only need to add myBayis in log4j can run sql statement is seen in the console.

The synchronous and asynchronous Ajax, how

Ajax in sync means that, when executed js ajax to this, and other code pages stop loading, appears suspended animation, when the Ajax finished, the page will continue to execute other code, the end state of suspended animation.
Instead asynchronous mean, to the implementation of Ajax when another page code continues to execute, there is no state of suspended animation.
As for implementation, only need to change the Ajax async, default fales, the default asynchronous. ture is synchronized.

What object class method

A total of 13 methods

Here Insert Picture Description

United-table query

field select the query
from table (1), table (2)
the WHERE condition relationship

例如:
select s.name
from class c,student s
where s.sid =c.cid

Difference map and set of

First, look for Map

  1. The map is not a sub-collection interface and implementation class, map an interface
  2. a map value of a key, e.g. Map <k, v> where v can be repeated, but may be unique only k, k may be a Null, but only one Null

I tell you Set

  1. set is not repeated
  2. set is an unordered container, you can not guarantee the order of arrangement set
  3. Also the most we can have a brother null,

Finally, I would, incidentally List

  1. list can be repeated
  2. list can also have a plurality of Null
  3. a list is sorted containers, each holding the inserted sequence, i.e., the output sequence is inserted

Arraylist difference with Array

  1. Arraylist with my words, then that will automatically expand the capacity of Array
  2. When you can not determine the size of the array can not be determined when it is used Arraylist, or otherwise use Array, because after all, high efficiency Array

Guess you like

Origin blog.csdn.net/weixin_44791262/article/details/90721868