´«ÖDz¥¿Íjavaѧϰ 3g¿ª·¢Android2
½ñÌìÊÇѧϰAndroid¿ª·¢µÄµÚ¶þÌ죺
½ñÌìÖ÷ҪѧϰÁËÎļþµÄ¶ÁÈ¡¡¢ÒÔ¼°¶ÔxmlÎļþµÄ½âÎö£º
ʹÓÃÎļþ½øÐÐÊý¾Ý´æ´¢£º
ActivityÌṩÁËopenFileOutput()·½·¨¿ÉÒÔÓÃÓÚ°ÑÊý¾ÝÊä³öµ½ÎļþÖУ¬¾ßÌåµÄʵÏÖ¹ý³ÌÓëÔÚJ2SE»·¾³Öб£´æÊý¾Ýµ½ÎļþÖÐÊÇÒ»ÑùµÄ¡£
public class FileActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
...
FileOutputStream outStream = this.openFileOutput("itcast.txt",
Context.MODE_PRIVATE);
outStream.write("´«ÖDz¥¿Í".getBytes());
outStream.close();
}
}
openFileOutput()·½·¨µÄµÚÒ»²ÎÊýÓÃÓÚÖ¸¶¨ÎļþÃû³Æ£¬²»ÄÜ°üº¬Â·¾¶·Ö¸ô·û“/” £¬Èç¹ûÎļþ²»´æÔÚ£¬Android
»á×Ô¶¯´´½¨Ëü¡£´´½¨µÄÎļþ±£´æÔÚ/data/data/<package
name>/filesĿ¼£¬È磺
/data/data/cn.itcast.action/files/itcast.txt
£¬Í¨¹ýµã»÷Eclipse²Ëµ¥“Window”-“Show
View”-“Other”£¬ÔÚ¶Ô»°´°¿ÚÖÐÕ¹¿ªandroidÎļþ¼Ð£¬Ñ¡ÔñÏÂÃæµÄFile ExplorerÊÓͼ£¬È»ºóÔÚFile
ExplorerÊÓͼÖÐÕ¹¿ª/data/data/<package
name>/filesĿ¼¾Í¿ÉÒÔ¿´µ½¸ÃÎļþ¡£
openFileOutput()·½·¨µÄµÚ¶þ²ÎÊýÓÃÓÚÖ¸¶¨²Ù×÷ģʽ£¬ÓÐËÄÖÖģʽ£¬·Ö±ðΪ£º
Context.MODE_PRIVATE
= 0
Context.MODE_APPEND
= 32768
Context.MODE_WORLD_READABLE = 1
Context.MODE_WORLD_WRITEABLE = 2
Context.MODE_PRIVATE
£º
ΪĬÈϲÙ×÷ģʽ£¬´ú±í¸ÃÎļþÊÇ˽ÓÐÊý¾Ý£¬Ö»Äܱ»Ó¦Óñ¾Éí·ÃÎÊ£¬ÔÚ¸ÃģʽÏ£¬Ð´ÈëµÄÄÚÈݻḲ¸ÇÔÎļþµÄÄÚÈÝ£¬Èç¹ûÏë°ÑÐÂдÈëµÄÄÚÈÝ×·¼Óµ½ÔÎļþÖС£¿ÉÒÔʹÓÃContext.MODE_APPEND
Context.MODE_APPEND
£º
ģʽ»á¼ì²éÎļþÊÇ·ñ´æÔÚ£¬´æÔÚ¾ÍÍùÎļþ×·¼ÓÄÚÈÝ£¬·ñÔò¾Í´´½¨ÐÂÎļþ¡£
Context.MODE_WORLD_READABLEºÍContext.MODE_WORLD_WRITEABLEÓÃÀ´¿ØÖÆÆäËûÓ¦ÓÃÊÇ·ñÓÐȨÏÞ¶Áд¸ÃÎļþ¡£
MODE_WORLD_READABLE
£º±íʾµ±Ç°Îļþ¿ÉÒÔ±»ÆäËûÓ¦ÓöÁÈ¡£»MODE_WORLD_WRITEABLE
£º±íʾµ±Ç°Îļþ¿ÉÒÔ±»Æ
Ïà¹ØÎĵµ£º
¶ÔÓÚÕâ¸öϵÁÐÀïµÄÎÊÌ⣬ÿ¸öѧJavaµÄÈ˶¼Ó¦¸Ã¸ã¶®¡£µ±È»£¬Èç¹ûÖ»ÊÇѧJavaÍæÍæ¾ÍÎÞËùνÁË¡£Èç¹ûÄãÈÏΪ×Ô¼ºÒѾ³¬Ô½³õѧÕßÁË£¬È´²»ºÜ¶®ÕâЩÎÊÌ⣬Ç뽫Äã×Ô¼ºÖعé³õѧÕßÐÐÁС£ÄÚÈݾùÀ´×ÔÓÚCSDNµÄ¾µäÀÏÌù¡£
ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
String s = "Hello world!";
¡¡Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄÊÂÇ飬µ«ÊÇ£¬ÎÒÃǵ½µ×ÉùÃ÷ÁËʲô£¿»Ø´ðͨ ......
Debug͸ÊÓͼ
http://www.cnblogs.com/Jamesliang/archive/2010/01/09/1643188.html
µ±µã»÷Debug°´Å¥Ê±£¬Eclipse»áÌáʾÄã½øÈë Debug͸ÊÓͼ¡£¿ÉÒÔÔÚÓÒÉÏ·½Expressions´°¿Úµã»÷Êó±êÓÒ¼üÔÚµ¯³ö²Ëµ¥ÖÐÑ¡Ôñ Add Watch Expression »òÕßµã»÷ÈçÏÂͼËùʾ°´Å¥Ôò»á³öÏÖ£¬Ìí¼Ó±í´ïʽ´°¿Ú¡£Äã¿ÉÒÔÊäÈëÄã ......
public class DeadLock {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
final Object resource1 = "resource1";
final Object resource2 = "resource2";
Thread t1 = new Thread(){
public void run(){
syn ......
Long long ago in a galaxy far,far away......
HakunaMatata
Ö÷Ò³²©¿ÍÏà²á|¸öÈ˵µ°¸ |ºÃÓÑ
²é¿´ÎÄÕÂ
ΪʲôҪÉèÖÃJAVA_HOME&Path&CLASSPATH&CATALINA_HOME
2008-01-19 14:26
Ê×ÏȵýéÉÜÏÂÃ漸¸ö²ÎÊýµÄ×÷Óãº
current directory(µ±Ç°Ä¿Â¼)£º
µ±Ç°ÔÚÓõÄĿ¼ ......
Integer n1 = new Integer(1);
Integer n2 = new Integer(1);
System.out.println(n1==n2); // false
Integer n1 = new Integer(3);
Integer n2 = new Integer(3);
System.out.println(n1.equals(n2)); //true
equals()ĬÈÏÒ²ÊDZȽÏreference£¬µ«ÊÇJavaÖеÄclass¸²¸ÇÁËequals()·½·¨ ......