java·½·¨µÄÖØÔØÓ븲¸Ç
java¶à̬µÄ2ÖÖ±íÏÖÐÎʽ ·½·¨ÖØÔغͷ½·¨¸²¸Ç
·½·¨ÖØÔØ£ºÍ¬Ò»¸öÀàÖУ¬·½·¨ÃûÏàͬ£¬²ÎÊýÁÐ±í²»Í¬µÄ2¸ö»ò¶à¸ö·½·¨¹¹³É·½·¨µÄÖØÔØ¡£
·½·¨¸²¸Ç£º×ÓÀàÖØÐÂʵÏÖÁ˸¸ÀàÖеķ½·¨¡£
·½·¨ÖØÔØ
/**
* ·½·¨ÖØÔØÂú×ãµÄÌõ¼þ
* ͬһ¸öÀàÖУ¬·½·¨ÃûÏàͬ£¬²ÎÊýÁÐ±í²»Í¬µÄ2¸ö»ò¶à¸ö·½·¨¹¹³É·½·¨µÄÖØÔØ
* ²ÎÊýÁÐ±í²»Í¬Ö¸²ÎÊýµÄÀàÐÍ£¬²ÎÊýµÄ¸öÊý£¬²ÎÊýµÄ˳ÐòÖÁÉÙÒ»Ïͬ
* ·½·¨µÄ·µ»ØÖµÀàÐÍ£¬·½·¨µÄÐÞÊηû¿ÉÒÔ²»Í¬¡£
*/
public class Overload{
public static void overLoad(int i){
System.out.println(i);
}
/* ÏÂÃæ·½·¨¶¼ÓëµÚÒ»¸ö·½·¨public static void overLoad(int i)Ïà±È½Ï*/
//public int overLoad(int k){}//´íÎ󣬲ÎÊýÁбíÏàͬ
//·µ»ØÖµÀàÐͲ»Ïàͬ
public int overLoad(int i,int k){
return 0;
}
//ÐÞÊηû²»Í¬
private void overLoad(double d){
}
//ÐÞÊηû£¬·µ»ØÖµÀàÐͶ¼²»Í¬
private double overLoad(double d,int k){
return 0;
}
}
·½·¨¸²¸Ç
/**
* ·½·¨¸²¸ÇÖ¸×ÓÀàÖØÐÂʵÏÖÁ˸¸ÀàÖеķ½·¨
* ·½·¨¸²¸ÇÔ¼ÊøÌõ¼þ£º
* 1.×ÓÀàµÄ·½·¨Ãû³Æ£¬²ÎÊýÁÐ±í£¬·µ»ØÖµÀàÐͱØÐëÓ븸ÀàÖз½·¨µÄÃû³Æ£¬²ÎÊýÁÐ±í£¬·µ»ØÖµÀàÐÍÒ»ÖÂ
* 2.×ÓÀà·½·¨²»ÄÜËõС¸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ£¬µ«¿ÉÒÔÀ©´ó
* 3.×ÓÀà·½·¨²»ÄÜÅ׳ö±È¸¸Àà·½·¨¸ü¶àµÄÒì³£,¿ÉÒÔ²»Å׳öÒì³£
*/
public class Override{
}
class Exception1 extends Exception{}
class Exception2 extends Exception1{}
class Exception3 extends Exception2{}
class Parent{
void method() throws Exception2{}
}
class Son extends Parent{
//private void method(){}//´íÎó£¬ËõСÁ˸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ
//int method(){} //´íÎ󣬷½·¨·µ»ØÖµÓ븸Àà·½·¨²»Ò»ÖÂ
void method(int k){} //ͨ¹ý±àÒ룬µ«²»Ó븸ÀàµÄ·½·¨method()¹¹³É¸²¸Ç
//public void method() throws Exception1{}//´íÎó Å׳ö±È¸¸Àà¸ü¶àµÄÒì³£
//public void method(){} //ÕýÈ· À©´ó¸¸Àà·½·¨µÄ·ÃÎÊȨÏÞ£¬²»Å׳öÒì³£
//void method() throws Exception3{}; //ÕýÈ· Å׳öµÄÒì³£±È¸¸ÀàÅ׳öµÄÒ쳣С
public void method() throws Exception3{}
}
Ïà¹ØÎĵµ£º
JAVA,List,Map,Set,ÈÝÆ÷
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
Collection½Ó¿Ú
¡¡¡¡CollectionÊÇ×î»ù±¾µÄ¼¯ºÏ½Ó¿Ú£¬Ò»¸öCollection´ú±íÒ»×éObject£¬¼´CollectionµÄÔªËØ£¨Elements£©¡£Ò»Ð© CollectionÔÊÐíÏàͬµÄÔªËØ¶ø ......
JavaÃæÊÔÌâ—»ù´¡·½Ãæ:
1¡¢×÷ÓÃÓòpublic,private,protected,ÒÔ¼°²»Ð´Ê±µÄÇø±ð£¿
´ð£ºÇø±ðÈçÏ£º
×÷ÓÃÓò µ±Ç°Àà ͬһpackag ×ÓËïÀà ÆäËûpackage
public √ √ √ √
protected √ √ √ ×
friendly √ √ × ×
pr ......
package com.hefeng.test;
import java.text.DateFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util ......
JavaÖÐInputstreamÓëReaderµÄÇø±ð
ReaderÖ§³Ö16λµÄUnicode×Ö·ûÊä³ö£¬InputStreamÖ§³Ö8λµÄ×Ö·ûÊä³ö¡£
ReaderºÍInputStream·Ö±ðÊÇI/O¿âÌṩµÄÁ½Ìׯ½ÐжÀÁ¢µÄµÈ¼¶»ú¹¹£¬
InputStream¡¢OutputStreamÊÇÓÃÀ´´¦Àí8λԪµÄÁ÷£¬
Reader¡¢WriterÊÇÓÃÀ´´¦Àí16λԪµÄÁ÷¡£
¶øÔÚJAVAÓïÑÔÖУ¬byteÀàÐÍÊÇ8λµÄ£¬charÀàÐÍÊÇ1 ......
Java ÀíÂÛºÍʵ¼ù: Á˽ⷺÐÍ Ê¶±ðºÍ±ÜÃâѧϰʹÓ÷ºÐ͹ý³ÌÖеÄÏÝÚå
JDK 5.0 ÖÐÔö¼ÓµÄ·ºÐÍÀàÐÍ£¬ÊÇ Java ÓïÑÔÖÐÀàÐͰ²È«µÄÒ»´ÎÖØÒª¸Ä½ø¡£µ«ÊÇ£¬¶ÔÓÚ³õ´ÎʹÓ÷ºÐÍÀàÐ͵ÄÓû§À´Ëµ£¬·ºÐ͵ÄijЩ·½Ãæ¿´ÆðÀ´¿ÉÄܲ»ÈÝÒ×Ã÷°×£¬ÉõÖÁ·Ç³£Ææ¹Ö¡£ÔÚ±¾ÔµÄ"Java Àí ......