Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java·´Éä3

1.2.5.MethodÀࣺ
Method´ú±íij¸öÀàµÄÒ»¸ö·½·¨£¬Ìṩ¹ØÓÚÀà»ò½Ó¿ÚÉϵ¥¶Àij¸ö·½·¨µÄÐÅÏ¢¡£Ëù·´Ó³µÄ·½·¨¿ÉÄÜÊÇÀà·½·¨»òʵÀý·½·¨£¨°üÀ¨³éÏó·½·¨£©¡£ Õâ¸öÀ಻ÄÑÀí½â£¬ËüÊÇÓÃÀ´·â×°·´ÉäÀà·½·¨µÄÒ»¸öÀà¡£
·½·¨
ÃèÊö
public String getName()
·µ»Ø´Ë Method ¶ÔÏó±íʾµÄ·½·¨Ãû³Æ
public Object invoke(Object obj,Object... args)
¶ÔÏóµ÷ÓÃÀàµÄ·½·¨¡£Èç¹ûobjΪnull£¬±íʾµ÷ÓÃÀàµÄ¾²Ì¬·½·¨¡£
 
¼òµ¥Ê¹ÓÃMethod´úÂë
       String str="abc";
Method methodCharAt = String.class.getMethod("charAt",
int.class);
       System.out.println(methodCharAt.invoke(str1, 1));
Á·Ï°£ºÐ´Ò»¸ö³ÌÐò£¬Äܹ»¸ù¾ÝÓû§ÌṩµÄÀàÃûÈ¥Ö´ÐиÃÀàÖеÄmain·½·¨
´úÂëÈçÏ£º
н¨Ò»¸öÀàTestArgumentsÌṩmain·½·¨
public class TestArguments{
    public static void main(String[] args){
       for(String arg : args){
           System.out.println(arg);
       }
    }
}
¿Í»§¶Ë²âÊÔ´úÂ룺
       String startingClassName = "TestArguments";
       Method mainMethod =
Class.forName(startingClassName).getMethod("main",
String[].class);
       mainMethod.invoke(null,
(Object)new String[]{"111","222","333"});
 
1.2.6.ArrayÀࣺ
Array¹¤¾ßÀàÓÃÓÚÍê³É¶ÔÊý×éµÄ·¢Éä²Ù×÷¡£
¾ßÓÐÏàͬά¶ÈºÍÔªËØÀàÐ͵ÄÊý×éÊôÓÚͬһ¸öÀàÐÍ£¬¼´¾ßÓÐÏàͬµÄClassʵÀý¶ÔÏó
´ú±íÊý×éµÄClassʵÀý¶ÔÏóµÄgetSuperclass£¨£©·½·¨·µ»ØµÄ¸¸ÀàΪObjectÀà¶ÔÓ¦µÄClass¡£
»ù±¾ÀàÐ͵ÄһάÊý×é¿ÉÒÔ±»µ±×÷ObjectÀàÐÍʹÓ㬲»Äܵ±×÷Object[]ÀàÐÍʹÓã»·Ç»ù±¾ÀàÐ͵ÄһάÊý×飬¼È¿ÉÒÔµ±×öObjectÀàÐÍʹÓã¬ÓÖ¿ÉÒÔµ±×öObject[]ÀàÐÍʹÓá£
Arrays.asList()·½·¨´¦Àíint[]ºÍString[]ʱµÄ²îÒì
Àý×Ó´úÂë:
       int [] a1 = new int[]{1,2,3};
       int [] a2 = new int[4];
       int[][] a3 = new int[2][3];
    


Ïà¹ØÎĵµ£º

javaÈëÃÅ

 Javaѧϰ´ÓÈëÃŵ½¾«Í¨ 
Ò»¡¢ JDK (Java Development Kit) 
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJ ......

javaÃæÊÔÌâ»ã¼¯

JAVAÏà¹Ø»ù´¡ÖªÊ¶
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ   
1.³éÏó£º
³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¼Ì³ÐÊÇÒ»ÖÖÁª½ ......

¼ò»¯JavaÓ¦ÓóÌÐòµÄ´ò°üºÍ·¢²¼

·¢²¼JavaÓ¦ÓóÌÐòʱÄã»á¸Ðµ½À§ÄÑ£¿ºÃÔÚJavaÌṩÁËһϵÁдò°üºÍ·¢²¼¹¤¾ß£¬¿ÉÒÔÏÔÖøµÄ¼ò»¯·¢²¼¹ý³Ì
¡¡¡¡
¡¡¡¡¸ÃÎÄÕÂÌṩÁË´ò°üJava codeµÄ¼¸ÖÖ·½·¨£¬ÎÒÃǽ«»á̽ÌÖJava manifest Îļþ£¬¸ø³öÓÃÓÚ¹ÜÀíJARÎļþËùÒÀÀµÎļþ¡¢¹À¼Æ¿çƽ̨·¢²¼ËùÐèµÄCLasspathµÄºÏÊÊ·½·¨.ÎÒÒ²»á½âÊÍÈçºÎʹÓÃmanifest°ü°æ±¾ÌØÐÔÀ´È·ÈÏ°üµÄ¼æÈÝÐÔ...
¡ ......

java .classÓëgetClassµÄÇø±ð

.classÆäʵÊÇÔÚjavaÔËÐÐʱ¾Í¼ÓÔؽøÈ¥µÄ
getClass()ÊÇÔËÐгÌÐòʱ¶¯Ì¬¼ÓÔصÄ
ÏÂÃæÒÔÀý×Ó˵Ã÷:
Ê×ÏȽ¨Ò»¸ö»ùÀàBaseclass
package classyongfa;
public class Baseclass {
private String height;
public String getHeight()
{
   return height;
}
public void setHeight(String height)
{
 
&n ......

java ²åÈëÅÅÐòºÍðÅÝÅÅÐòÑо¿

½ñÌ칫˾²»ÊǺÜ棬¾Í»Ø¹ËÁËÒ»ÏÂÒÔÇ°µÄðÅÝÅÅÐòºÍ²åÈëÅÅÐò
package chen;
import java.util.Date;
public class Sort {
 /**
  * ðÅÝÅÅÐò
  * @param list
  * @author chenpengye
  */
 public void sort(int[] list){
  long begain=new Date().getTime();
 &n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ