隨筆 - 303  文章 - 883  trackbacks - 0
          <2007年8月>
          2930311234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          歡迎光臨! 
          閑聊 QQ:1074961813

          隨筆分類(357)

          我管理的群

          公共blog

          • n維空間
          • Email : java3d@126.com 群 : 12999758

          參與管理的論壇

          好友的blog

          我的其他blog

          朋友的網站

          搜索

          •  

          最新評論


          public interface SinterFace {
             
          public final static String intstr="hello is interface";
             
          public abstract void nostat();
          }


          public class Useinter implements SinterFace {

              
          int inter = 5;
              
          static String str = "hello is class";
              
          public double dou = 1.0;
              
              
          public  void nostat() {
                  System.out.println(
          "is no static method");
              }


              
          public static void stat() {
                  System.out.println(
          "is static method");        
              }


          }


          public class Main {

              
          public static void main(String[] args) {
                  
                  System.out.println(
          "靜態變量方法在類實例化之前都可以調用:");
                  Useinter.stat();
                  System.out.println(Useinter.str
                          
          +"\n");
                  
                  System.out.println(
          "非靜態變量方法要在類實例化之后才可以調用:");        
                  Useinter useinter 
          = new Useinter();
                  useinter.nostat();
                  System.out.println(useinter.dou);
                  System.out.println(
          "類中沒聲明是private的變量默認都是public");
                  System.out.println(useinter.inter);


                  
                  System.out.println(
          "\n類里的靜態變量可以被實例調用:");
                  System.out.println(useinter.str
                            
          +"\n");
                 
                  System.out.println(
          "接口里的靜態變量可以直接被調用:");    
                  System.out.println(SinterFace.intstr);
              
              }


          }


          地震讓大伙知道:居安思危,才是生存之道。
          posted on 2007-08-19 22:32 小尋 閱讀(340) 評論(0)  編輯  收藏 所屬分類: j2se/j2ee/j2me
          主站蜘蛛池模板: 东光县| 仙游县| 清流县| 西平县| 嵊泗县| 永仁县| 介休市| 周至县| 通辽市| 亳州市| 米泉市| 常州市| 乾安县| 鄱阳县| 牡丹江市| 渭南市| 丘北县| 大渡口区| 伊川县| 铜山县| 花莲县| 扶风县| 合江县| 宜丰县| 闻喜县| 佛坪县| 厦门市| 砀山县| 五家渠市| 长岛县| 华池县| 阜阳市| 昭平县| 松桃| 绥滨县| 阳西县| 通道| 晋州市| 营口市| 龙海市| 金乡县|