Java接口中的字段默認都是靜態常量,不管在編碼的時候有沒有顯示的指定static或者final。
如以下接口:
public interface AccessFlag {
public int a = 10;
public static int b = 20;
public final int c = 30;
public static final int d = 40;
}
它編譯生成的二進制代碼如下:
public abstract interface org.levin.classfilereader.AccessFlag {
public static final int a = 10;
public static final int b = 20;
public static final int c = 30;
public static final int d = 40;
}
于2010年9月4日
注:這些文章都是前些時候寫的,之前博客很亂,也都是隨便貼一些自己寫的或轉載的,還有一些則是沒有貼出來過的。現在打算好好整理一下,完整的記錄自己的一些學習歷程,而每次看到過去的時間,則讓我想起以前的日子,因而我對時間一直是很重視的,所以每篇都著名寫的日期,直到最先的文章出現。:)
posted on 2011-06-23 23:51
DLevin 閱讀(1611)
評論(0) 編輯 收藏 所屬分類:
Core Java