java¼òµ¥¾²Ì¬´úÀí£¨¾ÛºÏ£©
¶¨ÒåÒ»¸ö½Ó¿Ú
package com.beckham;
/*
* ¶¨ÒåÒ»¸ö½Ó¿Ú
*/
public interface Move {
public void move() ;
}
ºËÐĵÄʵÏÖÀà
package com.beckham;
/*
* ×î³õµÄ½Ó¿ÚʵÏÖ
*/
public class Tank implements Move {
public void move() {
System.out.println("̹¿Ë¿ª¶¯.......");
}
}
ʵÏÖ·½·¨Ê±¼Ç¼ʱ¼ä
package com.beckham;
public class TankTime implements Move {
// ʵÏÖ×îÔʼµÄ½Ó¿Ú
private Move move;
public TankTime(Move move) {
this.move = move;
}
public void move() {
System.out.println(System.currentTimeMillis());
move.move();
}
}
ʵÏÖ·½·¨Ç°ºó¼ÓÈëÈÕÖ¾
package com.beckham;
public class TankLog implements Move {
// ʵÏÖ×îÔʼµÄ½Ó¿Ú
private Move move;
public TankLog(Move move) {
this.move = move;
}
public void move() {
System.out.println("̹¿Ë¿ªÊ¼ÈÕÖ¾......");
move.move();
System.out.println("̹¿Ë½áÊøÈÕÖ¾......");
}
}
¾ÛºÏʵÏÖ
package com.beckham;
public class Test {
public static void main(String[] args) {
// ×î³õµÄʵÏÖÀà
Move m = new Tank();
// ×îÀïÃæµÄ´úÀí
TankLog tl = new TankLog(m);
// ÍâÃæµÄ´úÀí
TankTime tt = new TankTime(tl);
//½Ó¿ÚµÄ¾ÛºÏ
tt.move();
}
}
²âÊÔ½á¹û
1262316711937
̹¿Ë¿ªÊ¼ÈÕÖ¾......
̹¿Ë¿ª¶¯.......
̹¿Ë½áÊøÈÕÖ¾......
µ½´ËΪֹ£¬Ò»¸ö¼òµ¥µÄ¾²Ì¬´úÀí¾ÍÍê³ÉÁË£¬ÆäʵÍê³ÉµÄ¹¦ÄܾÍÊÇÒªÔÚÒѾʵÏֵĽӿڵķ½·¨Ç°ºó¼ÓһЩÓëºËÐÄÎ޹صŦÄÜ£¬²ÉÓýӿڵľۺÏʵÏֱȽÏÁé»î¡£
Ïà¹ØÎĵµ£º
¸÷ÖÖ²»Í¬µÄJava °æ±¾£¬ÔÚÆäÖ§Ô®µÄºËÐÄÀà±ðº¯Ê½¿âÖ®ÍêÕûÐÔÒÔ¼°ËùÖ§Ô®µÄ Java »ù±¾ÐͱðÕâÁ½¼þÊÂÇéÉ϶¼ÓÐËù²îÒ죬Ҳ¾ÍÊÇ˵£¬²»¹ÜÄú¿ª·¢µÄÊÇÆóÒµËùʹÓõÄJava ³ÌÐò¡¢Ç¶ÈëʽװÖÃÉÏÖ´ÐеÄJava ³ÌÐò¡¢ä¯ÀÀÆ÷ÉÏÖ´ÐеÄApplet £¬»òÊÇÔÚPC ÉÏÖ´ÐеÄÓ¦ÓóÌÐò¡£Äú¶¼±ØÐëÔÚÄúµÄµçÄÔÉÏÏÈ°²×° J2SE £¬È»ááÔÙ°²×°¸÷ÖÖ°æ±¾µÄºËÐÄÀà± ......
1¡¢StringÊÇ×î»ù±¾µÄÊý¾ÝÀàÐÍÂð?
»ù±¾Êý¾ÝÀàÐÍ°üÀ¨byte¡¢int¡¢char¡¢long¡¢float¡¢double¡¢booleanºÍshort¡£
java.lang.StringÀàÊÇfinalÀàÐ͵ģ¬Òò´Ë²»¿ÉÒԼ̳ÐÕâ¸öÀà¡¢²»ÄÜÐÞ¸ÄÕâ¸öÀࡣΪÁËÌá¸ßЧÂʽÚÊ¡¿Õ¼ä£¬ÎÒÃÇÓ¦¸ÃÓÃStringBufferÀà
2¡¢int ºÍ Integer ÓÐʲôÇø±ð
Java ÌṩÁ½ÖÖ²»Í¬µÄÀàÐÍ£ºÒýÓÃÀàÐͺÍÔʼÀàÐÍ£¨ ......
ÃæÏò¶ÔÏóÔÀíÓëJava
ʵ¼ù¿Î³ÌʵÑé´úÂë¼°±¨¸æ
ʵÑé
1
£º¶ÔÏóºÍÀà
ʵÑéÄÚÈÝ£º
¡¡¡¡
1
¡¢³¢ÊÔÁ½È˺Ï×÷±àд³ÌÐò£¬¼ÓÉî¶Ô·½·¨µÄ½Ó¿ÚÓëʵÏÖµÄÀí½â¡£ÆäÖÐÒ»È˸ºÔð±àд·½·¨
isPrime()
£¬ÓÃÓÚÅжÏÒ»¸ö¸ø¶¨µÄÕýÕûÊýÊÇ·ñËØÊý£¬ÁíÒ»¸öÈ˸ºÔð±àдÖ÷·½·¨
main()
£¬ÀûÓÃ
isPrime()
ÑéÖ¤ÖøÃûµÄ¸çµÂ°ÍºÕ²ÂÏ룺ÈκαÈ
......
MD5½éÉÜ£º
MD5µÄÈ«³ÆÊÇMessage-Digest Algorithm 5£¬ÔÚ90Äê´ú³õÓÉMITµÄ¼ÆËã»ú¿ÆѧʵÑéÊÒºÍRSA Data Security Inc·¢Ã÷£¬¾MD2¡¢MD3ºÍMD4·¢Õ¹¶øÀ´¡£
Message-Digest·ºÖ¸×Ö½Ú´®(Message)µÄHash±ä»»£¬¾ÍÊÇ°ÑÒ»¸öÈÎÒⳤ¶ÈµÄ×Ö½Ú´®±ä»»³ÉÒ»¶¨³¤µÄ´óÕûÊý¡£Çë×¢ÒâÎÒʹÓÃÁË“×Ö½Ú´®”¶ø²»ÊÇ“×Ö·û´®”Õâ¸ö´Ê£¬ ......
java¹¹Ô캯Êý
ÆäÓï·¨¸ñʽÈçÏ£º
< modifiers> <class_name>([< argu_list>]) {[< statements>]}
×Ô¶¨Òå¹¹Ôì·½·¨£º·½·¨ÃûÓëÀàͬÃû£¬Ê××Öĸ´óд£¡Ã»Óзµ»ØÀàÐÍ¡£³ý´ËÖ®ÍâÆäËû¶¼¸úÆÕͨ·½·¨Ò»Ñù¡£
ĬÈϹ¹Ô캯Êý£ºÃ»ÓÐÐβÎûÓз½·¨Ì壡È磺public Person() {}
¶ÁÏÂÃæµÄÀý×Ó£¬Ìå ......