java½Ó¿ÚºÍ³éÏóÀàµÄÇø±ð
¼òµ¥À´Ëµ£¬ ½Ó¿ÚÊǹ«¿ªµÄ£¬ÀïÃæ²»ÄÜÓÐ˽Óеķ½·¨»ò±äÁ¿£¬ÊÇÓÃÓÚÈñðÈËʹÓõģ¬¶ø³éÏóÀàÊÇ¿ÉÒÔÓÐ˽Óз½·¨»ò˽ÓбäÁ¿µÄ£¬ÁíÍ⣬ʵÏÖ½Ó¿ÚµÄÒ»¶¨ÒªÊµÏÖ½Ó¿ÚÀﶨÒåµÄËùÓз½·¨£¬¶øʵÏÖ³éÏóÀà¿ÉÒÔÓÐÑ¡ÔñµØÖØдÐèÒªÓõ½µÄ·½·¨¡£
Ò»°ãµÄÓ¦ÓÃÀ×¼¶µÄÊǽӿڣ¬È»ºóÊdzéÏóÀàʵÏÖ½Ó¿Ú£¬×îºó²Åµ½¾ßÌåÀàʵÏÖ¡£
»¹ÓУ¬½Ó¿Ú¿ÉÒÔʵÏÖ¶àÖؼ̳У¬¶øÒ»¸öÀàÖ»Äܼ̳ÐÒ»¸ö³¬À࣬µ«¿ÉÒÔͨ¹ý¼Ì³Ð¶à¸ö½Ó¿ÚʵÏÖ¶àÖؼ̳У¬½Ó¿Ú»¹Óбêʶ£¨ÀïÃæûÓÐÈκη½·¨£¬ÈçRemote½Ó¿Ú£©ºÍÊý¾Ý¹²Ïí£¨ÀïÃæµÄ±äÁ¿È«Êdz£Á¿£©µÄ×÷ÓÃ.
1.abstract class ÔÚ Java ÓïÑÔÖбíʾµÄÊÇÒ»Öּ̳йØϵ£¬Ò»¸öÀàÖ»ÄÜʹÓÃÒ»´Î¼Ì³Ð¹Øϵ¡£µ«ÊÇ£¬Ò»¸öÀàÈ´¿ÉÒÔʵÏÖ¶à¸öinterface.
2.ÔÚabstract class
ÖпÉÒÔÓÐ×Ô¼ºµÄÊý¾Ý³ÉÔ±£¬Ò²¿ÉÒÔÓзÇabstarctµÄ³ÉÔ±·½·¨£¬¶øÔÚinterfaceÖУ¬Ö»Äܹ»Óо²Ì¬µÄ²»Äܱ»Ð޸ĵÄÊý¾Ý³ÉÔ±£¨Ò²¾ÍÊDZØÐëÊÇ
static finalµÄ£¬²»¹ýÔÚ interfaceÖÐÒ»°ã²»¶¨ÒåÊý¾Ý³ÉÔ±£©£¬ËùÓеijÉÔ±·½·¨¶¼ÊÇabstractµÄ¡£
3.abstract classºÍinterfaceËù·´Ó³³öµÄÉè¼ÆÀíÄͬ¡£Æäʵabstract class±íʾµÄÊÇ"is-a"¹Øϵ£¬interface±íʾµÄÊÇ"like-a"¹Øϵ¡£
4.ʵÏÖ³éÏóÀàºÍ½Ó¿ÚµÄÀà±ØÐëʵÏÖÆäÖеÄËùÓз½·¨¡£³éÏóÀàÖпÉÒÔÓзdzéÏó·½·¨¡£½Ó¿ÚÖÐÔò²»ÄÜÓÐʵÏÖ·½·¨¡£
5.½Ó¿ÚÖж¨ÒåµÄ±äÁ¿Ä¬ÈÏÊÇpublic static final ÐÍ£¬ÇÒ±ØÐë¸øÆä³õÖµ£¬ËùÒÔʵÏÖÀàÖв»ÄÜÖØж¨Ò壬Ҳ²»ÄܸıäÆäÖµ¡£
6.³éÏóÀàÖеıäÁ¿Ä¬ÈÏÊÇ friendly ÐÍ£¬ÆäÖµ¿ÉÒÔÔÚ×ÓÀàÖÐÖØж¨Ò壬Ҳ¿ÉÒÔÖØи³Öµ¡£
7.½Ó¿ÚÖеķ½·¨Ä¬È϶¼ÊÇ public£¬abstract ÀàÐ͵ġ£
Ïà¹ØÎĵµ£º
Map¡¢Set¡¢Iteratorµü´úÏê½â
Map½Ó¿Ú¶¨ÒåÁËËÄÖÖÀàÐ͵ķ½·¨£¬Ã¿¸öMap¶¼°üº¬ÕâЩ·½·¨¡£
equals(Object o)±È½ÏÖ¸¶¨¶ÔÏóÓë´ËMapµÄµÈ¼ÛÐÔ¡£
hashCode()·µ»Ø´ËMapµÄ¹þÏ£Âë¡£
Map¶¨ÒåÁ˼¸¸öÓÃÓÚ²å·ÅºÍɾ³ýÔªËصı任·½·¨¡£
remove(Object key) ´ÓMapÖÐɾ³ý¼üºÍ¹ØÁªµÄÖµ¡£
put(object key,Object value) ½«Ö¸¶¨ÖµÓëÖ¸¶¨¼üÏà¹Ø ......
ѧϰÁËÁ½ÆªµÄRuntimeÀ࣬ÏÖÔÚ¶ÔËüÓÐÁ˸üÉîÒ»²ãµÄÁ˽⣬ÄÇôÎÒÃÇÀ´¿´¿´ÏÂÃæµÄ´úÂ룺
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader ;
import java.io.BufferedReader;
public class Exec_Output{
public static void main(String []args)throws IOException,Int ......
Java ¶àÏ̱߳à³ÌÖ®Áù£ºÏß³ÌÖ®¼äµÄͨÐÅ£¨¸½Ô´´úÂ룩
Ô´´úÂëÏÂÔØ
¶àÏ̱߳à³ÌÖУ¬Ïß³ÌÖ®¼äµÄͨÐÅÊÇÒ»¸ö±È½Ï¸´ÔÓµÄÎÊÌâ¡£´ó¼ÒÍùÍù¸ã²»¶®Ê²Ã´ÊǾºÕù×ÊÔ´£¿Ê²Ã´Ê±ºò¿¼ÂÇͬ²½£¿Ôõô½øÐÐͬ²½£¿Ê²Ã´ÊÇÏß³ÌͨÐÅ£¿Ôõô½øÐÐͨÐÅ£¿ºÜ
¶àÅóÓÑÃæÊÔµÄʱºò¶¼Óöµ½¹ýÕâÑùÀàËƵÄÒ»¸ö±à³ÌÌ⣺¸ø¶ ......
class Super { static int taxi = 1729; }
class Sub extends Super {
static { System.out.print("Sub "); }
}
class Test {
public static void main(String[] args) {
System.out.println(Sub.taxi);
}
}
Êä³ö£º1729
֪ʶҪµã£º
A reference to a class field causes initialization of ......
1¡¢Æ¥ÅäË«ÒýºÅ¼äÄÚÈÝ£º
Java´úÂë
public
void
test1() {
// Æ¥ÅäË«ÒýºÅ¼äÄÚÈÝ
String pstr = "\"([^\"]+)\""
;
Pattern ......