Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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
  


Ïà¹ØÎĵµ£º

javaÒýÓÃ


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 ......

java ²é¿´Îļþ¼ÐÏÂÃæËùÓÐÎļþÒÔ¼°Îļþ¼Ð

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;
  ......

̸JAVAÈËÔ±ÃæÊÔ

¡¡¡¡½ñÌìÒ»ÅóÓѵĹ«Ë¾µ¹±ÕÁË£¬Ô­Òò²»ÖªµÀΪʲô¡£ËûÃÇÊǸºÔð¹«Ë¾ERP¿ª·¢µÄ£¬¿ª·¢¹ýºóÒ²¾Í³ÉÁËά»¤ÈËÔ±ÁË£¬ÓõÄÊÇJAVAÄÇһϵÁй¤¾ß×öµÄ¡£Ã»°ì·¨£¬ËäÈ»ÔÚÄÇÀï¸ÉÁ˼¸ÄêÁË£¬ÎªÁËÉú¼Æ»¹µÃÕÒ¹¤×÷£¬¼ÌÐøÕÒJAVA·½ÃæµÄÊ£¬ÃæÊÔÒ²ÃæÁ˼¸¼Ò¹«Ë¾ÁË£¬ÎÒÄÇÅóÓÑÌ«ÀÏʵ£¬ÊÇʲô˵ʲô£¬Ò²²»Ïëµã»ªÀöµÄ´ÊÔ壬½ñÌìËû¸úÎÒËßÁËһͨµÄ¿à£¬ËûºÜÓôà ......

javaÉú³ÉJNIÍ·Îļþ

JavahÉú³ÉJNIÍ·Îļþ
¼ÙÉ蹤³ÌĿ¼ÏÂÓÐbinÎļþ¼Ð£¬bin´æ·Å±àÒëºÃµÄclassÎļþ;
ÔÚbinĿ¼Ï£¬
......\koalaTest\bin>javah -classpath . -jni com.jni.vikitest
È»ºóÔÚ.....\koalaTest\bin ¼´¿ÉÕÒµ½Ò»¸öcom_jni_Calculator.hÍ·Îļþ£¬Éú³É³É¹¦£¡ ......

JavaÖеÄtransient£¬volatileºÍstrictfp¹Ø¼ü×Ö

JavaÖеÄtransient£¬volatileºÍstrictfp¹Ø¼ü×Ö
    Èç¹ûÓÃtransientÉùÃ÷Ò»¸öʵÀý±äÁ¿£¬µ±¶ÔÏó´æ´¢Ê±£¬ËüµÄÖµ²»ÐèҪά³Ö¡£ÀýÈ磺
Java´úÂë
class T {   
   transient int a;  //²»ÐèҪά³Ö   
   int b;  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ