Java·´Éä»úÖÆ:Constructor!
import org.junit.Test;
public class ConstructorTest {
@Test @SuppressWarnings("unchecked")
public void testConstructor(){
try {
Class clazz = Class.forName("cn.vicky.utils.User");
Method method = clazz.getDeclaredMethod("getName");
Constructor<? extends Live> constructor = clazz.getConstructor(String.class);
System.out.println(method.invoke(constructor.newInstance("Vicky")));
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
}
}
abstract class Live{
String name;
public Live(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
class User extends Live{
public User(String name) {
super(name);
}
public String getName() {
return " ---> " +name;
}
}
´òÓ¡:
---> Vicky
Ïà¹ØÎĵµ£º
Java³ÌÐòÔ±µ½¼Ü¹¹Ê¦µÄÍƼöÔĶÁÊé¼®ÊÕ²Ø
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄ³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò»Ñù£¬Õâ¸ö½×¶ÎÐèÒªÄã¿ìËÙµÄÕÆÎÕJava»ù´¡Óï·¨ºÍ»ù±¾Ó÷¨£¬×ÚÖ¼¾ÍÊÇ“àñàðÍÌÔæ²»ÇóÉõ½â”£¬ÏȶÔJavaÊìϤÆðÀ´ÔÙ˵¡£Óú̵ܶÄʱ¼ä¿ìËÙ¹ýÒ»±éJavaÓï·¨£¬Á¬ã´ø²Â¶àдд´úÂ룬Ҫ“ÖªÆäÈ»&r ......
package com.whlongyi.sys.blob.bean;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
im ......
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒ
Ìض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµºÍ¹¹Ôì²ã´Î½á¹¹£¬È»ºó²ÅÄÜ×öÈκι¤×÷¡£ÓÉÓÚËüÊÇ»ùÓÚÐÅÏ¢²ã´ÎµÄ£¬Òò¶øDOM±» ......
JavaÓïÑÔµÄÊäÈëÊä³ö¹¦ÄÜÊÇÊ®·ÖÇ¿´ó¶øÁé»îµÄ£¬ÃÀÖв»×ãµÄÊÇ¿´ÉÏÈ¥ÊäÈëÊä³öµÄ´úÂë²¢²»ÊǺܼò½à£¬ÒòΪÄãÍùÍùÐèÒª°ü×°Ðí¶à²»Í¬µÄ¶ÔÏó¡£ÔÚJavaÀà¿âÖУ¬IO²¿·ÖµÄÄÚÈÝÊǺÜÅÓ´óµÄ£¬ÒòΪËüÉæ¼°µÄÁìÓòºÜ¹ã·º:±ê×¼ÊäÈëÊä³ö£¬ÎļþµÄ²Ù×÷£¬ÍøÂçÉϵÄÊý¾ÝÁ÷£¬×Ö·û´®Á÷£¬¶ÔÏóÁ÷£¬zipÎļþÁ÷....±¾ÎĵÄÄ¿µÄÊÇΪ´ó¼Ò×öÒ»¸ö¼òÒªµÄ½éÉÜ¡£
¡¡¡¡Á ......