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

JavaÎļþ²Ù×÷´óÈ«£¨Áù£©

39.дÈëXMLÊý¾Ý¿â
//import java.io.*;
//import javax.xml.parsers.*;
//import org.xml.sax.*;
//import org.w3c.dom.*;
//import javax.xml.transform.*;
//import javax.xml.transform.dom.*;
//import javax.xml.transform.stream.*;
private Document document;
private Element node;
File xml_file=new File(%%1);
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder=factory.newDocumentBuilder();
document=builder.parse(xml_file);
} catch(Exception e) {
e.printStackTrace();
}
String subNodeTag=%%2;
Element rootNode=document.getDocumentElement();
//%%2="serverList" //%%4="id" //%%6="port"
//%%3="server" //%%5="ipaddr"
NodeList nlist=rootNode.getElementByTagName(subNodeTag);
node=document.createElement(%%3);
node.setAttribute(%%4,nlist.getLength()+1).toString());
node.appendChild(document.createTextNode("\n");
Element ipNode=document.createElement(%%5);
ipNode.appendChild(document.createTextNode(%%8));
node.appendChild(ipNode);
node.appendChild(document,createTextNode("\n");
Element port=document.createElement(%%6);
port.appendChild(document.createTextNode(%%9));
node.appendChild(port);
node.appendChild(document,createTextNode("\n");
nlist.appendChild(node);
TransformerFactory tFactory=TransformerFactory.newInstance();
Transformer transformer=null;
try {
transformer=tFactory.newTransformer();
DOMSource source=new DOMSource(document);
StreamResult result=new StreamResult(xml_file);
transformer.transform(source,result);
} catch(Exception e) {
e.printStackTrace();

40.ZIPѹËõÎļþ
//import java.io.*;
//import java.util.zip.*;
//´´½¨ÎļþÊäÈëÁ÷¶ÔÏó
FileInputStream fis=new FileInputStream(%%1);
//´´½¨ÎļþÊä³öÁ÷¶ÔÏó
FileOutputStream fo


Ïà¹ØÎĵµ£º

ubuntuÏ£¬C/C++ͨ¹ýJNIµ÷Óà JAVAÀà

֮ǰд¹ýÒ»¸öʵÏÖÁËijÖÖ¹¦ÄܵÄjava³ÌÐò£¬µ«ÓÉÓÚ½üÈÕ“¹¤×÷”ÐèÒª£¬ÓÖÐèÒªÔÚc/c++ÖÐÖØÐÂʹÓøù¦ÄÜ¡£ÎªÁ˽Úʡʱ¼ä£¬ÎÒ²ÉÈ¡ÁËÔÚc/c++Öе÷ÓÃjava³ÌÐòµÄ·½·¨£¬µ«Ö®Ç°Ã»ÓнӴ¥¹ýÀàËƵĶ«Î÷£¬µ½ÍøÉÏÒ»²é£¬¹ûÈ»ÓÐÀàËƵĶ«Î÷£¬ÐÄÖаµÏ²ing...¡£²éµ½µÄ×ÊÁÏÖÐÓм¸¸ö²»´íµÄÍøÒ³£º
      &nbs ......

JAVA×Ô¶¯×°ÏäÓë²ðÏä

×Ô¶¯×°ÏäÓë²ðÏäµÄ¹¦ÄÜÊÂʵÉÏÊDZàÒëÆ÷À´°ïÄúµÄ棬±àÒëÆ÷ÔÚ±àÒëʱÆÚÒÀÄúËù±àдµÄÓï·¨£¬¾ö¶¨ÊÇ·ñ½øÐÐ×°Ïä»ò²ðÏ䶯×÷¡£ÀýÈ磺
Integer i = 100.Ï൱ÓÚ±àÒëÆ÷×Ô¶¯ÎªÄú×÷ÒÔϵÄÓï·¨±àÒ룺
Integer i = new Integer(100).ËùÒÔ×Ô¶¯×°ÏäÓë²ðÏäµÄ¹¦ÄÜÊÇËùνµÄ“±àÒëÆ÷ÃÛÌÇ”(Compiler Sugar)£¬ËäȻʹÓÃÕâ¸ö¹¦Äܷܺ½±ã£¬µ ......

java BigdecimalµÄÓ¦ÓÃ

import java.io.*;
import java.math.*;
import java.util.*;
public class Main
{
    public static void main(String[] args)
    {
        Scanner cin=new Scanner(System.in);
        BigDecimal a; ......

JavaÎļþ²Ù×÷´óÈ«£¨¶þ£©

11.дÈëÊôÐÔ
//import java.io.*;
File filereadonly=new File(%%1);
try {
boolean b=filereadonly.setReadOnly();
}
catch (Exception e) {
System.out.println("¾Ü¾øд·ÃÎÊ£º"+e.printStackTrace());

12.ö¾ÙÒ»¸öÎļþ¼ÐÖеÄËùÓÐÎļþ
//import  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ