From the Java reflection mechanism analysis (I) API, we can see many interfaces and classes. What can we do through these interfaces?
From the previous API, we can see that it can complete the following functions:
1) obtain the class
A. Use getclass () (each class has this function)
I. String STR = "ABC ";
Ii. Class C1 = Str. getclass ();
B. Use class. forname () (static method is most often used)
I. Class C1 = Class. forname ("
execution methodIf the reflection is to invoke a private method of the class, the Mehtod object corresponding to the private method is firstCall Setaccessible (True)Class C1 = Testreflection.class;testreflection T1 = (testreflection) c1.newinstance (); Use reflection to createObject of the building classSystem.out.println ("username = =" + T1.username);SYSTEM.OUT.PRINTLN ("Password = =" + T1.password);method = C1.getdeclaredmethod ("Setusername", String.class);Method.invoke (T1, "Learning from
Java Code examples for Org.apache.commons.codec.binary.Base64InputStream
The following are top voted examples for showing. These examples are extracted from open source projects. You can vote up the examples your like and your votes'll be used with our system to product for
W object cannot be produced//so be judged to avoid a null pointer exception if (w! = null) {try {//Close stream resource, need to catch Exception w.close () again; } catch (IOException e) {e.printstacktrace (); } } }}}The contents of the file are written as follows:Reference article: http://developer.51cto.com/art/201309/410902.htmhttp://www.ibm.com/developerworks/cn/java/j-lo-javaio/ Copyright NOTICE:
); //here, you can send messages to the server.Channel.write (Bytebuffer.wrap (NewString ("Send a message to the server")). GetBytes ())); //after the connection with the server is successful, in order to receive the information from the server, you need to set the Read permission to the channel. Channel.register ( This. Selector, selectionkey.op_read); //A readable event is obtained}Else if(Key.isreadable ()) {read (key); } } } } /*** Handling events that read informatio
Code examples of four open source systems for processing Word, Excel, and PDF documents in JavaMany people often encounter a problem when using Java for document operations, that is, how to obtain the content of documents such as Word, Excel, and PDF? I have studied and summarized several methods for extracting word and PDF.
1. Use Jacob to Extract files such as Word and Excel.
In fact, Jacob is a bridage,
referenceextends t> r = Reallypoll (); if (r! = null) return R; for (;;) {lock.wait (timeout); r = Reallypoll ();...... }} That is, in the execution of a thread, the Monitor of this object is first obtained with synchronized (corresponding tolocked ); When executing to lock.wait (timeout), the thread discards the ownership of Monitor and enters the "Wait Set" queue (corresponding to theWaiting on )。 5) from the stack information, is the remote references to remote objects is being cleaned u
public class ArraylistExtends abstractlistImplements ListResizable-array implementation of the List interface.Example1. Create a new ArrayList objectNew Arraylist2. Adding elements to themBrands.add ("Jack Amber");3. Complete Example//Beerexpert.java, excerpted from Dawn Griffiths David Griffiths, "Head first Android development",Importjava.util.ArrayList;Importjava.util.List; Public classBeerexpert {Listgetbrands (String color) {ListNewArraylist(); if(Color.equals ("Amber") {Brands.add
Introduction to Pipelines (PipedOutputStream and PipedInputStream), source analysis, and examples
In this chapter, we learn about Java piping.
Java Piping Introduction
In Java, PipedOutputStream and pipedinputstream are pipe output streams and pipe input streams respectively.
Their role is to allow multithreading to
time, that is, if notify ()/ Notifyall () is followed by code, and will continue, knowing that the current thread is finished before releasing the synchronized lock object;
3.notify ()/notifyall () after execution, if the right has a sleep () method, will cause the current thread into the blocking state, but the synchronization object lock is not released, still keep their own, then will continue to execute this thread, next to the same 2;
4.wait ()/notify ()/nitifyall () the communication or
Transferred from: http://www.cnblogs.com/lzq198754/p/5780340.htmlProfile:Syntax and examples for Java regular expressions| | Catalogue
1 Match Verification-verify email is correct
2 querying a character or string in a string
3 Common Regular Expressions
4 Regular Expression syntax
1 Match Verification-Verify email is correct Java |Copy
The examples in this article describe the objects and object references in Java. Share to everyone for your reference. The specific analysis is as follows:
In Java, there is a group of nouns often appear together, they are "objects and object references", many friends in the beginner Java may often confuse these 2 con
In the near future, we plan to first write some serious things at hand, and then release a few Java game development examples. Then we will go back and tidy up the loonframework project, which cannot be updated for two years ...... Besides, the loonframework-alpha-Dao on the internet is "authentic Alpha", a pure draft (-_-), and only the DaO part is sent ...... When we release 0.2, we can see the changes ..
About string memory allocation Good blog: http://blog.csdn.net/rj042/article/details/6871030
several examples of string constant pool problems
Example 1:
Java code
String s0= "Kvill";
String s1= "Kvill";
String s2= "kv" + "ill";
System.out.println (S0==S1);
System.out.println (S0==S2);
The results are:
True
True
Analysis: First of all, we have to know that the result of the Tao
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.