New Ket Web Java Brush Question 10.3

Source: Internet
Author: User

1, the definition has stringbuffer s1=new StringBuffer (Ten); S1.append ("1234") what are S1.length () and s1.capacity () respectively?

Length () returns the current lengths

When the append string length is less than the initialization length, capacity returns the initialization length, and returns the length of the increment if it is greater than the initialization length.

The default length of Ps:stringbuffer and StringBuilder is 16;arraylist and linkedlist default length is 10.

2.

after executing the following code, the elements in the numberlist are:

list<integer> numberlist =newarraylist<integer> ();Numberlist.add (2);Numberlist.add (4);Numberlist.add (1);Numberlist.add (3);Numberlist.add (5);for (int i =0;i<numberlist.size (); ++i){int v = numberlist.get (i);if (v%2==0){Numberlist.remove (v);}}System.out.println (numberlist);

1.ArrayList After the element is deleted, the remaining elements move forward sequentially, so the subscript keeps changing, and size () decreases;The 2.remove () method calls remove (int index), not remove (Object O), so the element at the index index is deleted3, there are four ways to implement session tracking technology: URL Rewrite, hide form fields, cookies, session.
1). Hide form fields: <input type= "hidden", ideal for session applications that require a large amount of data storage.
2). URL rewrite: The URL can be appended with parameters, and the server's request is sent together, these parameters are name/value pairs.
3). Cookie: A cookie is a small, named data element. The server uses the Set-cookie header to use it as an HTTP
Part of the response is delivered to the client, the client is requested to save the Cookie value, and the subsequent request to the same server uses a
The Cookie header returns it to the server. Compared to other technologies, one of the advantages of cookies is that after the end of a browser session, even
It can still retain its value after the client computer restarts
4). Session: Bind an object to a session using the SetAttribute (String str,object obj) method

New Ket Web Java Brush Question 10.3

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.