javaÄÚ²¿Àà×ܽá
¶¨ÒåÔÚÒ»¸öÀàÄÚ²¿µÄÀà½ÐÄÚ²¿À࣬°üº¬ÄÚ²¿ÀàµÄÀà³ÆΪÍⲿÀà¡£ÄÚ²¿Àà¿ÉÒÔÉùÃ÷public¡¢protected¡¢privateµÈ·ÃÎÊÏÞÖÆ£¬¿ÉÒÔÉùÃ÷Ϊ
abstractµÄ¹©ÆäËûÄÚ²¿Àà»òÍⲿÀà¼Ì³ÐÓëÀ©Õ¹£¬»òÕßÉùÃ÷Ϊstatic¡¢finalµÄ£¬Ò²¿ÉÒÔʵÏÖÌض¨µÄ½Ó¿Ú¡£staticµÄÄÚ²¿ÀàÐÐΪÉÏÏóÒ»¸ö¶À
Á¢µÄÀ࣬·ÇstaticÔÚÐÐΪÉÏÀàËÆÀàµÄÊôÐÔ»ò·½·¨ÇÒ½ûÖ¹ÉùÃ÷staticµÄ·½·¨¡£ÄÚ²¿Àà¿ÉÒÔ·ÃÎÊÍⲿÀàµÄËùÓз½·¨ÓëÊôÐÔ£¬µ«staticµÄÄÚ²¿ÀàÖ»ÄÜ·Ã
ÎÊÍⲿÀàµÄ¾²Ì¬ÊôÐÔÓë·½·¨¡£
JavaµÄÉè¼ÆÕßÔÚÄÚ²¿ÀàÉíÉϵÄÈ·ÊÇרÐÄÁ¼¿à¡£Ñ§»áʹÓÃÄÚ²¿À࣬ÊÇ°ÑÎÕJava¸ß¼¶±à³ÌµÄÒ»²¿·Ö£¬Ëü¿ÉÒÔÈÃÄã¸üÓÅÑŵØÉè¼ÆÄãµÄ³ÌÐò½á¹¹¡£
ΪʲôÐèÒªÄÚ²¿Àࣿ
javaÖеÄÄÚ²¿ÀàºÍ½Ó¿Ú¼ÓÔÚÒ»Æ𣬿ÉÒÔʵÏÖ¶à¼Ì³Ð¡£
¿ÉÒÔʹijЩ±àÂë¸ù¼ò½à¡£
Òþ²ØÄã²»ÏëÈñðÈËÖªµÀµÄ²Ù×÷¡£
·Ç¾²Ì¬ÄÚ²¿Àà¶ÔÏóÓÐ×ÅÖ¸ÏòÆäÍⲿÀà¶ÔÏóµÄÒýÓÃ
Ò»¸ö¾²Ì¬³ÉÔ±À࣬ÈôÈ¥µô“static”¹Ø¼ü×Ö£¬¾Í³ÉΪ³ÉÔ±Àà¡£
public class InnerClass {
private static String nickName = "anan";
private String name;
private int age;
public InnerClass(String name, int age)
{
this.name = name;
this.age = age;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public class Inner
{
&nbs
Ïà¹ØÎĵµ£º
cmd
set path=javacËùÔÚÎļþ¼Ð£¨²»°üÀ¨javac)
ÔÚÈÎÒâÎļþ¼ÐÏÂÖ±½ÓʹÓÃjavac.exe,µ«µ±cmd ¹Ø±Õʱ£¬¾Í²»ÔÙÆð×÷ÓÃ
set classpath=...
×÷ÓÃ:ÔÚÈÎÒâÎļþ¼ÐÏÂÖ±½ÓʹÓÃ.classÎļþ£¬µ«µ±cmd ¹Ø±Õʱ£¬¾Í²»ÈðÆð×÷ÓÃ
²é¿´£ºset pathh; set classpath
ÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿ÉèÖÃ
Óû§±äÁ¿£º
±äÁ¿Ãû£ºclasspat ......
import java.util.LinkedList;
//µ¥Ïò¶ÓÁÐ
public class Queue {
public Queue() {
}
private LinkedList list = new LinkedList();
public void pu ......
1¡¢ÀûÓÃSystem.getProperty()º¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
System.out.println(System.getProperty("user.dir"));//user.dirÖ¸¶¨Á˵±Ç°µÄ·¾¶
2¡¢Ê¹ÓÃFileÌṩµÄº¯Êý»ñÈ¡µ±Ç°Â·¾¶£º
File directory = new File("");//É趨Ϊµ±Ç°Îļþ¼Ð
try{
System.out.println(directory.getCanonicalPa ......
Ê÷ÊÇÒ»¸öµÝ¹éµÄÊý¾Ý½á¹¹£¬Ò»¿ÃÊ÷ÉϵÄËùÓнڵ㶼¿ÉÒÔ±»¿´³ÉÊÇÒ»¿ÃÊ÷£¬Ö»²»¹ý³ý¸ù½ÚµãÍâÆäËû½Úµã¶¼±È×ÜÊ÷µÄ¹æģСµã¶øÒÑ¡£Ê÷µÄ½ÚµãÓÐÈýÖÖ£º¸ù½Úµã£¨Ã»Óи¸Ç׽ڵ㣩£¬Ò¶×ӽڵ㣨ûÓк¢×ӽڵ㣩£¬Ò»°ã½Úµã£¨¼ÈÓи¸Ç׽ڵ㣬ҲÓк¢×ӽڵ㣩¡£¾ßÌå¶Ô½á¹¹µÄ·ÖÎö£¬¼¸ºõËùÓÐдÊý¾Ý½á¹¹µÄÊéÖж¼ÓÐÌáµ½¡£
Õâ¿ÃÊ÷µÄʵÏÖ»¨Á˺ü¸Ììʱ¼ä£¬ ......
JavaÖеļòµ¥¹¤³§Ä£Ê½
¾ÙÁ½¸öÀý×ÓÒÔ¿ìËÙÃ÷°×JavaÖеļòµ¥¹¤³§Ä£Ê½£º
Å®æ´ÞÒÍÁÔìÈË
»°Ëµ£º“ÌìµØ¿ª±Ù£¬Î´ÓÐÈËÃñ£¬Å®æ´ÞÒÍÁΪÈË¡£”Å®æ´ÐèÒªÓÃÍÁÔì³öÒ»¸ö¸öµÄÈË£¬µ«ÔÚÅ®æ´Ôì³öÈË֮ǰ£¬È˵ĸÅÄîÖ»´æÔÚÓÚŮ洵Ä˼ÏëÀïÃæ¡£
Å®æ´ÔìÈË£¬Õâ¾ÍÊǼòµ¥¹¤³§Ä£Ê½µÄÓ¦Óá£
¡¡¡¡Ê×ÏÈ£ ......