Javaµ÷ÓÃϵͳÃüÁîѧϰ£¨Ò»£©
ºÇºÇ¡£¡£
import java.io.*;
class Exec{
public static void main(String []args)throws IOException{
//LinuxϵͳÃüÁls £l
String command = "ls -l";
//»ñÈ¡µ±Ç°ÏµÍ³µÄ»·¾³¡£
Runtime rt = Runtime.getRuntime();
//Ö´ÐÐ
Process p = null;
p = rt.exec(command);
//»ñÈ¡Ö´ÐкóµÄÊý¾Ý
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String msg = null;
//Êä³ö¡£
while((msg = br.readLine())!=null){
System.out.println(msg);
}
br.close();
}
}
ÉÏÃæµÄ´úÂë±È½Ï¼òµ¥£º
ÆäÖзÖΪ¼¸¸ö²½Ö裺
1.»ñÈ¡µ±Ç°ÏµÍ³µÄÔËÐл·¾³¡£
2.ÔÚµ±Ç°ÏµÍ³Ö´ÐÐϵͳÃüÁî¡£
3.Ö´Ðк󣬻ñÈ¡ÆäÖ´ÐкóµÄÊý¾Ý¡£
4.Êä³öÊý¾Ý¡£
5.½áÊø¡£
========================================================================
ÉÏÃæÊǶÔÖ´ÐÐϵͳÃüÁîºó£¬·µ»Ø½á¹û¡£Æäʵ»¹¿ÉÒÔµ÷ÓÃϵͳµÄ³ÌÐòÖ´ÐУ¬ÕâÔÚÏÂһƪ»á½²µ½¡£
Ïà¹ØÎĵµ£º
javaÖеÄËÄÖÖÀàÐ͵ļ¯ºÏÀà
£¨1£©Vector £¨2£©BitSet£¨3£©Stack£¨4£©HashTable
2ö¾ÙÆ÷
ÔÚÈκμ¯ºÏÀàÖУ¬±ØÐëͨ¹ýijÖÖ·½·¨ÔÚÆäÖÐÖÃÈë¶ÔÏó£¬ÔÙÓÃÁíÒ»ÖÖ·½·¨´ÓÖÐÈ¡µÃ¶ÔÏó¡£ÔÚVectorÖУ¬addElement()¾ÍÊÇÎÒÃDzåÈë¶ÔÏó²ÉÓõķ½·¨
£¬¶þelementAt()ÔòÊÇÌáÈ¡¶ÔÏóµÄΨһ·½·¨¡£
Iterator¿ÉÒÔ´ïµ½Õâ¸öÄ¿µÄ£¬ËüÊÇÒ»¸ö¶ÔÏó£¬×÷ÓÃÊDZ ......
×î½üÒ»¶Îʱ¼ä¿´µ½ÁËylmf os һʱÊÖÑ÷°²×°ÁË¡£×¼±¸°ÑʹÓÃÖÐÓöµ½µÄÎÊÌâ½øÐмǼ£¬Òѱ»²»Ê±Ö»Ðè¡£
°²×°java·½·¨2ÖÖ£º
µÚÒ»ÖÖ£¬ÔÚÖÕ¶ËÖ´ÐÐÃüÁî½øÐÐÏÂÔØ¡£
´ò¿ªÖնˣ¬Ö´ÐÐÒÔÏÂÃüÁϵͳ»á×Ô¶¯ÏÂÔØJDK £¬²¢°²×°¡£
sudo apt-get install sun-java6-jdk
Èç¹û¿Õ¼ä²»¸»Ô£µÄ»°£¬¿ÉÒÔÖ»×°JRE
sudo apt-get install sun-java6- ......
package com.shxy.code;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
i ......
1¡¢ÖØÔØ(Overloading)
£¨1£©·½·¨ÖØÔØÊÇÈÃÀàÒÔͳһµÄ·½Ê½´¦Àí²»Í¬ÀàÐÍÊý¾ÝµÄÒ»ÖÖÊֶΡ£¶à¸öͬÃûº¯Êýͬʱ
´æÔÚ£¬¾ßÓв»Í¬µÄ²ÎÊý¸öÊý/ÀàÐÍ¡£ÖØÔØOverloadingÊÇÒ»¸öÀàÖжà̬ÐÔµÄÒ»ÖÖ±íÏÖ¡£
£¨2£©JavaµÄ·½·¨ÖØÔØ£¬¾ÍÊÇÔÚÀàÖпÉÒÔ´´½¨¶à¸ö·½·¨£¬ËüÃǾßÓÐÏàͬµÄÃû×Ö£¬µ«¾ß
Óв»Í¬µÄ²ÎÊýºÍ²»Í¬µÄ¶¨Òå¡£µ÷Ó÷½·¨Ê±Í¨¹ý´«µÝ¸øËüà ......
ÏëÔÚ¿ª·¢ÖÐÌá¸ßËٶȺÍЧÂÊ£¡²»ÄÜÍü¼ÇµÄEclipse¿ì½Ý¼ü
Eclipse¿ì½Ý¼ü´óÈ«
ÍƼöCtrl+1 ¿ìËÙÐÞ¸´(×î¾µäµÄ¿ì½Ý¼ü,¾Í²»Óöà˵ÁË)
Ctrl+D: ɾ³ýµ±Ç°ÐÐ
Ctrl+Alt+↓ ¸´ÖƵ±Ç°Ðе½ÏÂÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Ctrl+Alt+↑ ¸´ÖƵ±Ç°Ðе½ÉÏÒ»ÐÐ(¸´ÖÆÔö¼Ó)
Alt+↓ µ±Ç°ÐкÍÏÂÃæÒ»Ðн»»¥Î»ÖÃ(ÌرðʵÓÃ,¿ÉÒÔÊ¡È¥ÏȼôÇÐ,ÔÙÕ³Ìù ......