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

JAVA¹æÔò Öм¶Æª

±¾ÎĽéÉܵÄJAVA¹æÔòµÄ˵Ã÷·ÖΪ3¸öÖ÷Òª¼¶±ð£¬Öм¶ÊÇƽʱ¿ª·¢ÓõıȽ϶àµÄ¼¶±ð£¬ÔÚ½ñºó½«Â½Ðøд³öÆäËûµÄ¹æÔò¡£×ñÊØÁËÕâЩ¹æÔò¿ÉÒÔÌá¸ß³ÌÐòµÄЧÂÊ¡¢Ê¹´úÂëÓÖ¸üºÃµÄ¿É¶ÁÐԵȡ£
£¨1£©    ÔÚfinally·½·¨Àï¹Øµôinput»òÕßoutput ×ÊÔ´
ÔÙ·½·¨ÌåÀïÃ涨ÒåÁËinput»òÕßoutputÁ÷µÄ»°£¬ÐèÒªÔÚfinallyÀïÃæ°ÑËü¹Øµô¡£
ÒÔÏÂÕ⼸ÖÖµ÷Óò»ÐèÒª×ñÊØÕâÌõ¹æÔò£¬ÒòΪcolse()·½·¨²»Æð×÷Ó㺣©
java.io.StringWriter     java.io.ByteArrayOutputStream    java.io.ByteArrayInputStream
Èç¹ûÔÙ·½·¨·µ»ØµÄʱºòûÓе÷ÓÃclose()·½·¨À´ÊÍ·Åinput()ºÍoutput()µÄ×ÊÔ´µÄ»°£¬»áµ¼ÖÂÒ»¸öϵͳ×ÊԴй©¡£¶øÇÒÔÚÈκÎÇé¿ö϶¼ÒªÈ·¶¨ÔÚ·µ»ØÈ«µ÷ÓÃÁËclose() ·½·¨£¬°üÀ¨³öÏÖÒì³£µÄʱºò¡£ËùÒÔÐèÒªÔÚfinally·½·¨ÀïÃæ¼ÓÈëÕâ¸ö·½·¨¡£ÕâÑù¾Í±£Ö¤ÁËÔÚÈκÎÇé¿ö϶¼»á¹Ø±Õ×ÊÔ´¡£
 ´íÎóʾÀý£º
public class CIO {
    public void method (java.io.File f) {
    java.io.FileInputStream fis = null;
        try {
            fis = new java.io.FileInputStream (f);
            fis.read ();
            fis.close ();
        } catch (java.io.FileNotFoundException e1) {
            System.out.println("File not found");
        } catch (java.io.IOException e2) {
            System.out.println("I/O Exception");
        }
        // Èç¹û³öÏÖÒì³££¬ÕâÀï¾Í²»Äܱ£Ö¤¹Ø±Õ×ÊÔ´¡£
    }
}
ÐÞÕýºóµÄ´úÂ룺
public class CIOFixed {
    public void method (java.io.File f) {
    java.io.FileInputStream fis = null;
        try {
         &n


Ïà¹ØÎĵµ£º

java×Ô¶¯×°Ïä¡¢×Ô¶¯²ðÏäºÍÕý³£Çé¿öÐÔÄܱȽÏ

×Ô¶¯×°ÏäºÍ×Ô¶¯²ðÏäÊÇjava5.0°æ±¾ÒýÈëµÄ£¬ÄÜ×Ô¶¯½«»ù±¾ÀàÐÍת»»Îª¶ÔÓ¦µÄ»ù±¾ÀàÐÍ°ü×°¶ÔÏó£¬ÄÇôÎÒÃDZȽÏÒ»ÏÂËûÃǵÄÐÔÄÜÇé¿ö¡£
package com.wmmad.test;
import junit.framework.TestCase;
/**
* @author madding.lip
*
* <pre>
* class: compare the autoboxing and unboxing and normal's performance
......

java×÷Òµ01

package homework01;
public class TestWhile {

public static double factorial(int n) //Çó½×³Ëº¯Êý
{
if(n==0) return 1;
else return n* factorial(n-1);
}

public static void main(String[] args) {
System.out.println(factorial(170));//test:ÄÜ´òÓ¡³öÀ´£ ......

JAVA¶ÁÊé±Ê¼Ç£¨Ò»£©

1.±äÁ¿£º
¶ÔÓÚ»ù±¾ÀàÐ͵ÄÈ«¾Ö±äÁ¿£¬ÈôûÓгõʼ»¯£¬ÏµÍ³»á×Ô¶¯³õʼ»¯Îª¸ÃÀàÐ͵ijõʼֵ£»¶ø¶ÔÓÚ¾Ö²¿±äÁ¿£¬Ôò±ØÐëÏÔʾµÄ½øÐгõʼ»¯¡£
2.³£Á¿£º
final int M_Max=111;
final±íʾֻÄܸø±äÁ¿M_MAX¸³ÖµÒ»´Î£¬¸³ÖµÖ®ºó£¬M_MAXµÄÖµ¾Í²»¿ÉÒÔÖØи³Öµ¡£Ëù¸³µÄÖµ¿ÉÒÔÊÇÒ»¸ö±í´ïʽ£¬Ò²¿ÉÒÔÊÇÒ»¸ö¾ßÌåµÄÖµ¡£
3.Àà³£Á¿£º
static fina ......

Javaµ÷ÓÃLinuxÃüÁî

Java¿ÉÒÔÖ±½Óµ÷ÓÃLinuxÃüÁÐÎʽÈçÏ£º
 Runtime.getRuntime().exec(command)
 ¾ÙÀý£ºÔËÐÐls,topÃüÁî¿ÉÒÔÕâÑù£º
 Runtime.getRuntime().exec("ls");
 µ«ÊÇÕâÑùÖ´ÐÐʱûÓÐÈκÎÊä³ö£¬Ô­Òò£º 
 µ÷ÓÃRuntime.exec·½·¨½«²úÉúÒ»¸ö±¾µØµÄ½ø³Ì,²¢·µ»ØÒ»¸öProcess×ÓÀàµÄʵÀý£¬
£¨×¢Ò⣺Runtim ......

JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ

ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
 <book>
  <name>¹þÀï²¨Ì ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ