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

javaÐòÁл¯Óë·´ÐòÁл¯


import java.beans.XMLDecoder;
import java.beans.XMLEncoder;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/*******************************************************************************
 * ÐòÁл¯¶ÔÏóµ½xmlÎļþ
 * 
 * @author zzbk_c8
 * 
 */
public class ObjectToXMLUtil {
/***************************************************************************
* ÐòÁл¯·½·¨

* @param objÐòÁл¯¶ÔÏó
* @param fileName´æ·ÅµØÖ·
*/
public static void objectXmlEncoder(Object obj, String fileName) {
// ´´½¨Îļþ
File file = new File(fileName);
// ÅжÏÎļþÊÇ·ñ´æÔÚ£¬Èç²»´æÔÚ´´½¨
if (!file.exists()) {
// ÏÈ´´½¨ÎļþĿ¼
File filePath = new File(fileName.substring(0, fileName
.lastIndexOf("/")));
filePath.mkdirs();
}
try {
// ´´½¨ÎļþµÄÊä³öÁ÷
FileOutputStream out = new FileOutputStream(fileName);
// ´´½¨XMLÎļþ¶ÔÏóÊä³öÀà
XMLEncoder xmlEncoder = new XMLEncoder(out);
// ÀûÓÃxml¶ÔÏóÊä³öÀàÊä³ö¶ÔÏóµ½xmlÎļþ
xmlEncoder.writeObject(obj);
xmlEncoder.flush();
// ¹Ø±ÕÊä³ö¶ÔÏó
xmlEncoder.close();
try {
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println("ÎļþÊä³öÁ÷¹Ø±Õ´íÎó");
e.printStackTrace();
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
System.out.println("ÎļþÊä³öÁ÷´´½¨Ê§°Ü");
e.printStackTrace();
}
}
/***************************************************************************
* ·´ÐòÁл¯

* @param objSource
*            xmlÎļþ£¬·´ÐòÁл¯ÄÚÈÝ
* @return ·µ»Ø¼¯ºÏ
*/
public static List objectXmlDecoder(String objSource) {
// ÓÃÓÚ½ÓÊÕ´ÓxmlÖз²ÐòÁл¯³öÀ´µÄ¼¯ºÏ
List objList = new ArrayList();
// »ñÈ¡xml¶ÔÏóÎļþ×ÊÔ´£¨·´Ðò


Ïà¹ØÎĵµ£º

java퉀
ÏÈÉùÃ÷һϣ¬ÌâÄ¿Ô­³öÓÚ£ºhttp://gocom.primeton.com/modules/newbb/item60284_60284.htm
JVMÊÇJava³ÌÐòµÄÔËÐл·¾³£¬Òò´Ë¶ÔÓÚJVMµÄÕÆÎÕÓÐÖúÓÚÀí½âJava³ÌÐòµÄÖ´ÐÐÒÔ¼°±àд£¬ÓÈÆäÊÇÔËÐÐʱÅöµ½µÄһЩ¹îÒìÎÊÌ⣬ÄÇôÔõôÑùÄÜ¿¼²ì×Ô¼º¶ÔÓÚJVM¹Ø¼ü֪ʶµãµÄÕÆÎÕÇé¿ö£¬°ïÖúѧϰJVM»úÖÆÄØ£¬ÔÚÕâƪblogÖÐÀ´Ì½ÌÖÏ¡£
¶ÔÓÚJava³ÌÐò¶øÑ ......

Java ¼Ì³ÐСÀý

¿´¿´ÏÂÃæ³ÌÐò½«Êä³öʲô½á¹û£º
/**
* ShowExtending
* ÑÝʾ¼Ì³ÐʱµÄÏÖÏó
*/
class SupCls {
static String s1 = "¸¸ÀàÀà±äÁ¿s1";
String s2 = "¸¸ÀàʵÀý±äÁ¿s2";
SupCls(){
System.out.println("¸¸À๹ÔìÆ÷±»·ÃÎÊ");
}
public static void f1(){ ......

JavaÖ®Override OverloadÖ®¼äµÄÇø±ð


overrideÊǸ²Ð´£¬¶ÔÓ¦ÓÚOO±à³ÌµÄ¼Ì³ÐÌØÐÔ£¬Òâ˼¾ÍÊÇÔÚ×ÓÀàÖÐÖØд¸¸ÀàÖеķ½·¨£»   
overloadÊÇÖØÔØ£¬¶ÔÓ¦ÓÚOO±à³ÌµÄ¶à̬ÌØÐÔ£¬Òâ˼¾ÍÊÇÔÚͬһ¸öÀàÖÐͬÑùÃû³ÆµÄ¶à¸ö·½·¨£¬ Õâ¶à¸ö·½·¨Ö®¼äµÄÇø±ðÔÚËûÃǵIJÎÊýÁв»Í¬¡£
ÀýÈ磺
public interface UserDao {
public void save(); ......

JavaÃØÊ·£ºÒþ²ØÔÚSWT/Swing±³ºóµÄ¹ÊÊÂ

Òë×¢
£º±¾ÎÄÀ´×Ôstraight_talking_java@yahoogroups.comÌÖÂÛ×飬ÒѾ­ÊÇÒ»Äê¶àÇ°
µÄÎÄÕ¡£Alan WilliamsonÊÇJava Developers
JournalµÄ±à¼­£¬ÏÂÎÄÀ´×ÔËûÔÚIBMµÄÒ»¸öÏûÏ¢À´Ô´¡£SWTºÍSwingµÄÂÛÕùÎÒ¼û¹ý²»ÉÙ£¬NetbeansºÍEclipseµÄҲͬÑù¶à¡£ÒëÕß·­Òë
´ËÎIJ¢²»ÊÇÒª¼¤ÆðʲôÕùÖ´£¬Ò²²»ÊÇÖ§³ÖÄÄÒ»·½£¨ËäÈ»ÎÒµÄÈ·ÊÇÕ¾ÔÚSWTÒ»±ßµ ......

Java I/O³£ÓÃÁ÷ʾÀý


package io;   
import java.io.*;   
/**  
* @author ¸ßÕíÎâÓÇ  
* ÀûÓûº³åÇøÔ­Àí,BufferedInputStream,  
* ÊµÏÖµÄÎļþ×Ö½ÚÁ÷¶ÁÈ¡¹¦ÄÜʾ·¶  
*  
*/  
public class BufferedInOutputStream {  & ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ