java ÄÚ²¿Àà×ܽá
Ò»¡¢ ¶¨Òå
·ÅÔÚÒ»¸öÀàµÄÄÚ²¿µÄÀàÎÒÃǾͽÐÄÚ²¿Àà¡£
¶þ¡¢ ×÷ÓÃ
1.ÄÚ²¿Àà¿ÉÒԺܺõÄʵÏÖÒþ²Ø
Ò»°ãµÄ·ÇÄÚ²¿À࣬ÊDz»ÔÊÐíÓÐ private ÓëprotectedȨÏ޵ģ¬µ«ÄÚ²¿Àà¿ÉÒÔ
2£®ÄÚ²¿ÀàÓµÓÐÍâΧÀàµÄËùÓÐÔªËصķÃÎÊȨÏÞ
3.¿ÉÊÇʵÏÖ¶àÖؼ̳Ð
4.¿ÉÒÔ±ÜÃâÐ޸ĽӿڶøʵÏÖͬһ¸öÀàÖÐÁ½ÖÖͬÃû·½·¨µÄµ÷Óá£
Èý¡¢ Àý×Ó
1.ʵÏÖÒþ²Ø
ƽʱÎÒÃǶÔÀàµÄ·ÃÎÊȨÏÞ£¬¶¼ÊÇͨ¹ýÀàÇ°ÃæµÄ·ÃÎÊÐÞÊηûÀ´ÏÞÖƵģ¬Ò»°ãµÄ·ÇÄÚ²¿À࣬ÊDz»ÔÊÐíÓÐ private ÓëprotectedȨÏ޵ģ¬µ«ÄÚ²¿Àà¿ÉÒÔ£¬ËùÒÔÎÒÃÇÄÜͨ¹ýÄÚ²¿ÀàÀ´Òþ²ØÎÒÃǵÄÐÅÏ¢¡£¿ÉÒÔ¿´ÏÂÃæµÄÀý×Ó
½Ó¿Ú
package insidecategory;
public interface Incrementable
{
void increment();
}
¾ßÌåÀà
package insidecategory;
public class Example {
private class InsideClass implements InterfaceTest
{
public void test()
{
System.out.println("ÕâÊÇÒ»¸ö²âÊÔ");
}
}
public InterfaceTest getIn()
{
return new InsideClass();
}
}
ÉÏÃæ¼Ó´ÖµÄ²¿·ÖÊÇÄÚ²¿À࣬·ÃÎÊÐÞÊηûÊÇprivate
¿Í»§¶Ë³ÌÐò
package insidecategory;
public class TestExample {
public static void main(String args[])
{
Example a=new Example();
InterfaceTest a1=a.getIn();
a1.test();
}
}
¼Ó´ÖµÄÄDz¿·Ö¾ÍÊÇ¿Í»§¶Ëµ÷ÓõĴúÂ룬´ÓÕâ¶Î´úÂëÀïÃæÎÒÖ»ÖªµÀExampleµÄ
getIn()·½·¨ÄÜ·µ»ØÒ»¸öInterfaceTest ʵÀýµ«ÎÒ²¢²»ÖªµÀÕâ¸öʵÀýÊÇÕâôʵÏֵġ£¶øÇÒÓÉÓÚInsideClass ÊÇprivateµÄ£¬ËùÒÔÎÒÃÇÈç¹û²»¿´´úÂëµÄ»°¸ù±¾¿´²»µ½Õâ¸ö¾ßÌåÀàµÄÃû×Ö£¬ËùÒÔ˵Ëü¿ÉÒԺܺõÄʵÏÖÒþ²Ø¡£
2.¿ÉÒÔÎÞÌõ¼þµØ·ÃÎÊÍâΧÀàµÄËùÓÐÔªËØ
package insidecategory;
public class TagBean {
private String name="liutao";
private class InTest
 
Ïà¹ØÎĵµ£º
class Tank{
int level;
}
public class Assignment {
public static void main(String[] args) {
Tank t1 = new Tank();
Tank t2 = new Tank();
t1.level= 9;
t2.level= 47;
System.out.println("1:t1.l ......
import java.io.File;
import java.util.Date;
import java.util.Iterator;
import java.util.Vector;
import java.text.SimpleDateFormat;
public class FileViewer {
File myDir;
File[] contents;
Vector vectorList;
Iterator currentFileView;
File currentFile;
  ......
¡¡¡¡½ñÌìÒ»ÅóÓѵĹ«Ë¾µ¹±ÕÁË£¬ÔÒò²»ÖªµÀΪʲô¡£ËûÃÇÊǸºÔð¹«Ë¾ERP¿ª·¢µÄ£¬¿ª·¢¹ýºóÒ²¾Í³ÉÁËά»¤ÈËÔ±ÁË£¬ÓõÄÊÇJAVAÄÇһϵÁй¤¾ß×öµÄ¡£Ã»°ì·¨£¬ËäÈ»ÔÚÄÇÀï¸ÉÁ˼¸ÄêÁË£¬ÎªÁËÉú¼Æ»¹µÃÕÒ¹¤×÷£¬¼ÌÐøÕÒJAVA·½ÃæµÄÊ£¬ÃæÊÔÒ²ÃæÁ˼¸¼Ò¹«Ë¾ÁË£¬ÎÒÄÇÅóÓÑÌ«ÀÏʵ£¬ÊÇʲô˵ʲô£¬Ò²²»Ïëµã»ªÀöµÄ´ÊÔ壬½ñÌìËû¸úÎÒËßÁËһͨµÄ¿à£¬ËûºÜÓôà ......
JavahÉú³ÉJNIÍ·Îļþ
¼ÙÉ蹤³ÌĿ¼ÏÂÓÐbinÎļþ¼Ð£¬bin´æ·Å±àÒëºÃµÄclassÎļþ;
ÔÚbinĿ¼Ï£¬
......\koalaTest\bin>javah -classpath . -jni com.jni.vikitest
È»ºóÔÚ.....\koalaTest\bin ¼´¿ÉÕÒµ½Ò»¸öcom_jni_Calculator.hÍ·Îļþ£¬Éú³É³É¹¦£¡ ......
JavaÖеÄtransient£¬volatileºÍstrictfp¹Ø¼ü×Ö
Èç¹ûÓÃtransientÉùÃ÷Ò»¸öʵÀý±äÁ¿£¬µ±¶ÔÏó´æ´¢Ê±£¬ËüµÄÖµ²»ÐèҪά³Ö¡£ÀýÈ磺
Java´úÂë
class T {
transient int a; //²»ÐèҪά³Ö
int b;  ......