java È«¾Ö±äÁ¿ÊµÏÖ
class Global {
public static final String APPNAME= "xyz"; //È«¾Ö³£Á¿
public static String currentUser = "abc"; // È«¾Ö±äÁ¿
...
}
class WhatEver {
...
System.out.println(Global.APPNAME);
Global.currentUser = "Williams";
}
Ïà¹ØÎĵµ£º
ÿ¸öÍøÒ³»òÇëÇó¶¼ÊÇÒ»¸öurlµØÖ·£¬Ò»°ã£¬Õâ¸öµØÖ·¿ÉÄÜÊÇ.do,.page,.actionÖ®ÀàµÄ²¢¼ÓÉÏ'?'ºÅ¡¢'&'ºÅ²éѯ´®µÈ¹¹³ÉµÄÒ»¸ö³¤³¤µÄµÄurl¡£ºÜurgly¡£
Ò»°ãµÄurl----------------------------------------------------------½ÏºÃµÄurl
http://www.xxx.net/user/profile.do?id=20001 ====> http://www.xxx.ne ......
ÕâÊÇÒ»¸ö·Ç³£¼òµ¥µÄJavaÆåÀàÓÎÏ·£¨ßÀ£¬²»Ð¡ÐÄÑ¡ÁËÒ»ÕÅÕ¼Óÿռä±È½Ï´óµÄ±³¾°Í¼……£©£¬ÎÒÖ´ºì·½£¬µÐÖ´À¶·½£¬Ê×ÏȽ«ÉÏÏ»ò×óÓÒÁ½¶ËÆå×Ó¹áͨÕß¼´ÎªÊ¤Àû£¬ÒÔLGame-Simple-0.2.5¿ª·¢£¨Ô´ÂëÔÚjarÖУ©¡£
ÊÂʵÉÏ£¬ÎÒÃǾ³£¿ÉÒÔÔÚÍøÂçÖп´µ½ÓÐЩÍøÓÑ·´¸´Ñ°ÕÒÖîÈçÎå×ÓÆ塢ΧÆå¡¢ÏóÆåÖ®ÀàСÓÎÏ·µÄʾÀý³ÌÐò¡£Ã÷Ã÷ÍøÂçÉÏͬÀ ......
package homework03;
import java.util.Scanner;
/*
* ±àдһ¸öÀ࣬¸ÃÀàÓÐÒ»¸ö·½·¨
* public int f£¨int a£¬int b£©{
*
* }
* È»ºó±àдһ¸ö¸ÃÀàµÄ×ÓÀ࣬ҪÇóÖØд·½·¨f()£¬¶øÇÒÖØдµÄ·½·¨½«·µ»ØÁ½¸öÕûÊýµÄ×îС¹«±¶Êý¡£ÒªÇó£º
* ÔÚÖØдµÄ·½·¨µÄ·½·¨ÌåÖÐÊ×Ïȵ÷Óñ»Òþ²ØµÄ·½·¨·µ»ØaºÍbµÄ×î´ó¹«Ô¼Êým,È»ºó½«a*b/m ......
Java™ÓïÑÔ°üº¬Á½ÖÖÄÚÔÚµÄͬ²½»úÖÆ£ºÍ¬²½¿é£¨»ò·½·¨£©ºÍvolatile±äÁ¿¡£ÕâÁ½ÖÖ»úÖƵÄÌá³ö¶¼ÊÇΪÁËʵÏÖ´úÂëÏ̵߳ݲȫÐÔ¡£ÆäÖÐvolatile±äÁ¿µÄͬ²½ÐԽϲµ«ÓÐʱËü¸ü¼òµ¥²¢ÇÒ¿ªÏú¸üµÍ£©£¬¶øÇÒÆäʹÓÃÒ²¸üÈÝÒ׳ö´í¡£ÔÚÕâÆÚµÄJavaÀíÂÛÓëʵ¼ùÖУ¬Brian Goetz½«½éÉܼ¸ÖÖÕýȷʹÓÃvolatile±äÁ¿µÄģʽ£¬²¢Õë¶ÔÆäÊÊÓÃÐÔÏÞÖÆÌá³öÒ» ......
Çë¿´ÏÂÃæÒ»Àý£º
public class TestAbstract {
int count;
public void operation(){
System.out.println("count = " + (++count));
}
}
public class Test extends TestAbstract {
public static void main(String[] args) {
Test test = new Test();
TestAbstract testAb = new TestAbstract();
testAb.operati ......