JavaÖеÄÄÚ²¿ÀàºÍÄäÃûÀà
ÌáÆðJavaÄÚ²¿ÀࣨInner Class£©¿ÉÄܺܶàÈ˲»Ì«ÊìϤ£¬Êµ¼ÊÉÏÀàËƵĸÅÄîÔÚC++ÀïÒ²ÓУ¬ÄǾÍÊÇǶÌ×ÀࣨNested Class£©£¬¹ØÓÚÕâÁ½ÕßµÄÇø±ðÓëÁªÏµ£¬ÔÚÏÂÎÄÖлáÓжԱȡ£ÄÚ²¿Àà´Ó±íÃæÉÏ¿´£¬¾ÍÊÇÔÚÀàÖÐÓÖ¶¨ÒåÁËÒ»¸öÀࣨÏÂÎĻῴµ½£¬ÄÚ²¿Àà¿ÉÒÔÔںܶàµØ·½¶¨Ò壩£¬¶øʵ¼ÊÉϲ¢Ã»ÓÐÄÇô¼òµ¥£¬Õ§¿´ÉÏÈ¥ÄÚ²¿ÀàËƺõÓÐЩ¶àÓ࣬ËüµÄÓô¦¶ÔÓÚ³õѧÕßÀ´Ëµ¿ÉÄܲ¢²»ÊÇÄÇôÏÔÖø£¬µ«ÊÇËæ×ŶÔËüµÄÉîÈëÁ˽⣬Äã»á·¢ÏÖJavaµÄÉè¼ÆÕßÔÚÄÚ²¿ÀàÉíÉϵÄÈ·ÊÇÓÃÐÄÁ¼¿à¡£Ñ§»áʹÓÃÄÚ²¿À࣬ÊÇÕÆÎÕJava¸ß¼¶±à³ÌµÄÒ»²¿·Ö£¬Ëü¿ÉÒÔÈÃÄã¸üÓÅÑŵØÉè¼ÆÄãµÄ³ÌÐò½á¹¹¡£ÏÂÃæ´ÓÒÔϼ¸¸ö·½ÃæÀ´½éÉÜ£º
µÚÒ»´Î¼ûÃæ
public interface Contents {
int value();
}
public interface Destination {
String readLabel();
}
public class Goods {
private class Content implements Contents {
private int i = 11;
public int value() {
return i;
}
}
protected class GDestination implements Destination {
private String label;
private GDestination(String whereTo) {
label = whereTo;
}
public String readLabel() {
return label;
}
}
public Destination dest(String s) {
return new GDestination(s);
}
public Contents cont() {
return new Content();
&
Ïà¹ØÎĵµ£º
javaÓïÑÔÊǽâÊÍÖ´ÐУ¬javaÔ´ÂëÊÇͨ¹ý±àÒëÉú³ÉÒ»ÖÖÌØÊâµÄ.classµÄÖмä×Ö½âÂëÎļþ£¬È»ºóÔÙÓÐJVM½øÐнâÊÍÖ´ÐС£
javaÓïÑÔ¶ÔÖ¸Õë½øÐÐÁËÉϲãµÄ·â×°£¬Ëü±£Ö¤Äܹ»Í¨¹ýÕâ¸öÖ¸Õ루ÒýÓã©£¬À´·ÃÎÊÓÐЧµÄÄÚ´æµ¥Ôª¡£
javaÓïÑÔ²»ÔÊÐí¶à¼Ì³Ð£¬Ê¹¼Ì³Ð¹Øϵ³ÉÊ÷װͼ£¬Ã¿¸öÀ඼ֻÄÜÓÉÒ»¸ö¸¸Àà¡£
javaÓïÑԵĿª·¢Ð§Âʸߣ¬µ«Ö´ÐÐЧÂʵ͡££¨Ïൠ......
Ò»¡¢±à¼JavaÔ´Îļþ
=============================================
Hello.java
=============================================
package test;
public class Hello
{
static
{
try
{
//´Ë´¦¼´Îª±¾µØ·½·¨ËùÔÚÁ´½Ó¿âÃû
&n ......
¶¨Òå:¶¨ÒåÁËËã·¨×壬·Ö±ð·â×°ÆðÀ´£¬ÈÃËüÃÇÖ®¼ä¿ÉÒÔ»¥ÏàÌæ»»£¬´ËģʽÈÃËã·¨µÄ±ä»¯¶ÀÁ¢ÓÚʹÓÃËã·¨µÄ¿Í»§¡£
ÊÊÓÃÐÔ
Ðí¶àÏà¹ØµÄÀà½ö½öÊÇÐÐΪÓÐÒì¡£“²ßÂÔ”ÌṩÁËÒ»ÖÖÓöà¸öÐÐΪÖеÄÒ»¸öÐÐΪÀ´ÅäÖÃÒ»¸öÀàµÄËã·¨¡£
ÐèҪʹÓÃÒ»¸öËã·¨µÄ²»Í¬±äÌå¡£ÀýÈ磬Äã¿ÉÄܻᶨÒåһЩ·´Ó³²»ÈݵĿռä/ʱ¼äȨºâµÄËã·¨¡£µ±ÕâЩ±äÌåʵ ......
private static boolean isValidDate(String strValue ) {//20091001×Ö·û´®
int d = Integer.parseInt(strValue.substring(6, 8));
int m = Integer.parseInt(strValue.substring(4, 6));
int y = Integer.parseInt(strValue.subst ......