Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javaϵͳ¼à¿ØCPU ´ÅÅÌ


import java.io.*;   
  
/**
* linux ÏÂcpu ÄÚ´æ ´ÅÅÌ jvmµÄʹÓÃ¼à¿Ø
* @author avery_leo
*
*/  
public class TT {   
    /**
      * »ñÈ¡cpuʹÓÃÇé¿ö
      * @return
      * @throws Exception
      */  
    public double getCpuUsage() throws Exception {   
        double cpuUsed = 0;   
  
         Runtime rt = Runtime.getRuntime();   
         Process p = rt.exec("top -b -n 1");// µ÷ÓÃϵͳµÄ“top"ÃüÁî   
       
  
         BufferedReader in = null;   
        try {   
             in = new BufferedReader(new InputStreamReader(p.getInputStream()));   
             String str = null;   
             String[] strArray = null;   
           
            while ((str = in.readLine()) != null) {   
                int m = 0;   
                   
                if (str.indexOf(" R ") != -1) {// Ö»·ÖÎöÕýÔÚÔËÐеĽø³Ì£¬top½ø³Ì±¾Éí³ýÍâ &&am


Ïà¹ØÎĵµ£º

Java:Eclipse´úÂë×Ô¶¯Ìáʾ


EclipseÖÐĬÈÏÊÇÊäÈë"."ºó³öÏÖ×Ô¶¯Ìáʾ£¬ÓÃÓÚÀà³ÉÔ±µÄ×Ô¶¯Ìáʾ£¬¿ÉÊÇÓÐʱºòÎÒÃÇÏ£ÍûËüÄÜÔÚÎÒÃÇÊäÈëÀàµÄÊ××Öĸºó¾Í³öÏÖ×Ô¶¯Ìáʾ£¬¿ÉÒÔ½ÚÊ¡´óÁ¿µÄÊäÈëʱ¼ä£¨ËäÈ»°´alt + /»á³öÏÖÌáʾ£¬µ«»¹ÊÇÒª¶à°´Ò»´Î°´¼ü£¬Ì«Âé·³ÁË£©¡£
    ´ÓWindow -> preferences -> Java -> Editor -> Content assist - ......

ÿ¸öJava³õѧÕß¶¼¸ÃÃ÷°×µÄÎÊÌâ

ÿ¸öJava³õѧÕß¶¼Ó¦¸ÃÃ÷°×µÄÎÊÌâ
¶ÔÓÚÕâ¸öϵÁÐÀïµÄÎÊÌ⣬ÿ¸öѧJavaµÄÈ˶¼Ó¦¸Ã¸ã¶®¡£µ±È»£¬Èç¹ûÖ»ÊÇѧJavaÍæÍæ¾ÍÎÞËùνÁË¡£Èç¹ûÄãÈÏΪ×Ô¼ºÒѾ­³¬Ô½³õѧÕßÁË£¬È´²»ºÜ¶®ÕâЩÎÊÌ⣬Ç뽫Äã×Ô¼ºÖعé³õѧÕßÐÐÁС£ÄÚÈݾùÀ´×ÔÓÚCSDNµÄ¾­µäÀÏÌù¡£
¡¡¡¡ÎÊÌâÒ»£ºÎÒÉùÃ÷ÁËʲô£¡
String s = "Hello world!";
¡¡¡¡Ðí¶àÈ˶¼×ö¹ýÕâÑùµÄ ......

JAVA¹æÔò Öм¶Æª

±¾ÎĽéÉܵÄJAVA¹æÔòµÄ˵Ã÷·ÖΪ3¸öÖ÷Òª¼¶±ð£¬Öм¶ÊÇÆ½Ê±¿ª·¢ÓõıȽ϶àµÄ¼¶±ð£¬ÔÚ½ñºó½«Â½ÐøÐ´³öÆäËûµÄ¹æÔò¡£×ñÊØÁËÕâЩ¹æÔò¿ÉÒÔÌá¸ß³ÌÐòµÄЧÂÊ¡¢Ê¹´úÂëÓÖ¸üºÃµÄ¿É¶ÁÐԵȡ£
£¨1£©    ÔÚfinally·½·¨Àï¹Øµôinput»òÕßoutput ×ÊÔ´
ÔÙ·½·¨ÌåÀïÃæ¶¨ÒåÁËinput»òÕßoutputÁ÷µÄ»°£¬ÐèÒªÔÚfinallyÀïÃæ°ÑËü¹Øµô¡£
ÒÔÏÂ ......

JAVA¹æÔò ¿ª·¢Æª

±¾ÎĽéÉܵÄJAVA¹æÔòµÄ˵Ã÷·ÖΪ3¸öÖ÷Òª¼¶±ð£¬±¾ÆªÅׯúÁËÆ½Ê±¿ª·¢ÖкÜÉÙÓöµ½µÄÇé¿ö£¬ÄÇЩÓõñȽÏÉÙµÄÒÔºóÔٸ߼¶ÆªÀïÃæ³öÏÖ¡£²¢ÓÐÁù¸öÓÐÓõĹú¼ÊÈí¼þ¿ª·¢ÖØÒª×¢ÒâµÄÓйØStringµÄÎÊÌ⣬×ñÊØÁËÕâЩ¹æÔò¿ÉÒÔÌá¸ß³ÌÐòµÄЧÂÊ¡¢Ê¹´úÂëÓÖ¸üºÃµÄ¿É¶ÁÐԵȡ£
£¨1£© Èç¹ûÓÐJDBCÁ¬½ÓûÓйصôµÄ»°£¬ÐèÒªÔÚ"finally"·½·¨Öйصô
Èç ......

j2se·Ç³£¾­µäµÄÌâÄ¿ javaϰÌâÓë½â´ð

ÅжÏÌ⣺ÉùÃ÷int a = 10; ÅжÏÒÔÏÂ3¸öÔËËãÊÇ·ñÄܹ»·Ö±ðͨ¹ýJava±àÒëÆ÷£º
a = a/2;  a = a/3;  a = a*2.89;
½â£ºa = a*2.89;²»ÐУ¬a*2.89ÔËËã»áÌáÉý³ÉdoubleÀàÐÍ
Êý×éÓÐûÓÐlength()Õâ¸ö·½·¨? StringÓÐûÓÐlength()Õâ¸ö·½·¨£¿
½â£ºÊý×éûÓÐlength()Õâ¸ö·½·¨£¬ÓÐlengthµÄÊôÐÔ¡£
¡¡¡¡ StringÓÐÓÐlength()Õ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ