JAVA·´Éä»úÖÆÊÂÀý¶þ
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
try {
Class cls = com.lwf.util.CommonUtil.class;
Object obj = cls.newInstance();
Method addMethod = cls.getMethod("add", new Class[]{int.class,int.class});
Object value = addMethod.invoke(obj, new Object[]{new Integer(12),new Integer(23)});
System.out.println((Integer)value);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
package com.lwf.util;
public class CommonUtil {
public static void getName(){
System.out.println("this is a getName function");
}
public void getMethod(){
System.out.println("this is a getMethod funciton");
}
public int add(int m ,int n){
return m + n;
}
}
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
package demo;
class InOut{
String str=new String("Between");
static int i=666;
int j=888;
final int k=999;
public void amethod(final int iArgs){
int it315;
final int x=111;
/*static*/ class Bicycle
{
//&n ......
package demo;
class TA{
//Õâ¸ö³ÌÐòÒªºÃºÃÀí½â,³£Á¿²»ÊÇÊôÓÚÀàµÄ£¬ËüÔÚÄÚ´æÖÐÓÐÒ»¿éµ¥¶ÀµÄ´æ´¢ÇøÓò£¬ºÎÀàTAÎÞÈκιØϵ
// public static final int m=9;
// ¾²Ì¬±äÁ¿ÊÇÊôÓÚÀàµÄ£¬ËüµÄ´æ´¢ÇøÓòÓëÀàÏà¹Ø
public static int m=9;
static {
System.out.println("In Static m=" ......
ÏÖÔÚ ËùÓÃJava°æ±¾,DateÀ๹Ôì·½·¨Date(0)µÄʱ¼ä²»ÊÇThu Jan 01 01:00:00 GMT 1970ÁË£¬¶øÊÇThu Jan 01 08:00:00 CST 1970¡££¨ 1970 Äê1 ÔÂ1 ÈÕ8ʱ0·Ö0Ãë ÐÇÆÚ4£©
Ϊʲô Date b1=new Date(623289600000); ²»¿ÉÒÔ£¬ÏÂÃæµÄÈ´¿ÉÒÔÄØ£¿
long a=623289600000L;
Date b1=new Date(a); Ò ......
import
java.util.Random;
/**
*
ÅÅÐò²âÊÔÀà
*
*
ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
*
1.
²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
*
2.
½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
*
3.
Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£»
  ......