Memory stream:
Memory input stream: Memory --->ProgramBytearrayinputstream and chararrayreader
Memory output stream: Program ---> memoryBytearrayoutputstream, chararraywriter
The memory stream does not need to be closed. The read operations
Features of list:
(1) List has an ordered set, and each element in the SET has a corresponding sequence.
(2) duplicate elements can be used in the list set and corresponding elements can be accessed through indexes.
Import Java. util. arraylist;
Exercise: Use stringbuilder or stringbuffer:Convert the string "ABCDE" into the string "a, B, c, d"
Public class stringbuildertest {public static void main (string [] ARGs) {stringbuilder sb = new stringbuilder ("ABCDE"); system. out. println
Http://acm.hdu.edu.cn/contests/contest_showproblem.php? PID = 1001 & cid = 439
Java is really good and powerful. As long as the Java foundation is better, such a question is simple.
Note that the month and date of the calendar class are not
Occasionally, we can add some shortcut keys to users, regardless of the current focus.
One practice is to register your listener on any build, but obviously this is not a good practice
Java toolkit can directly add a listener,
The following is an
Public class testenum {/* the most common enumeration */Public Enum colorselect {red, green, yellow, blue;}/* The enumeration can also add methods and attributes like a general class, you can add static and non-static attributes or methods for it,
Objective: to convert an interface of a class into another interface that the customer wants. The A d a p t e r mode makes those classes that cannot work together due to interface incompatibility work together. Intent:
You want to use an existing
Every time you reinstall or upgrade JDK, you forget how to associate myeclipse with the help documentation. Then, it will take another 10 minutes to search again on Google!
First, download the javadoc API help documentation. Just search for it by
Package Mediator. MyTest; // rent an abstract class lodger {int maxmoney; int minmoney; String name; public abstract void rented (); public abstract void statisticsHouse ();}
Package Mediator. MyTest; // The landlord abstract class landlord {int
Package ParttenDesign; // Command interface of the general public interface Command {void defend (); void attack ();}
The command action the General wants the soldiers to send
Package ParttenDesign; public class Commander implements Command
To repeat a single character, it is very simple. Simply add a qualifier after the character. For example, a + indicates matching one or more of the,? Matches 0 or 1. These delimiters are as follows:X?X, Neither once nor onceX*X, Zero or multiple
Import java. util .*;
Class InsertSort
{
ArrayList al;
Public InsertSort (int num, int mod)
{
Al = new ArrayList (num );
Random rand = new Random ();
System. out. println ("The ArrayList Sort Before :");
For (int I = 0; I {
Al. add (new Integer
When many new Java users see the following code, they will ask a question: what are the three dots in the dealArray square method?
Public class TestVarArgus {
Public static void dealArray (int... intArray ){}
Public static void main (String args [])
I. Similarities and Differences between m + = n and m = m + n
In general, the two are the same, but there is a difference in the following example.
Public class Test {public static void main (String [] args) {short width = 10; width + = 2; //
Exercise 1: Write a method to determine whether a given string is a combination of full numbers
Exercise 2: compile a method to determine whether a given string is a phone number
Package day7; import java. util. regex. matcher; import java. util.
Thread communication C-P exercise: the bucket stores "name, gender" type of data, the producer is responsible for putting data to the bucket, the consumer is responsible for getting data from the bucket. Program to realize the C-P relationship. And
Reflection is to map each component in the Java class into a java object. Using Reflection technology, you can dissect a class and map each component into objects. The biggest use of reflection is in framework learning.
How to obtain the class
First, take a look at a piece of code to test everyone. Please output the following code results without running the program:
class Insect {int i = 9;int j;Insect() {prt("i = " + i + ", j = " + j);j = 39;}static int x1 = prt("static Insect.x1
This is the statistical time class I searched for myself. I wrote a log to record how to use java to count the time.
Here, the Time class and Timer class are not used to record the Time, and the knowledge uses the running Time of the process to
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