ÉîÈë̽Ë÷Java¶ÔÏóµÄÐòÁл¯
¶ÔÏóÐòÁл¯¾ÍÊǰѶÔÏóдÈëµ½Êä³öÁ÷ÖУ¬ÓÃÀ´´æ´¢»òÕß´«Êä¡£
¶ÔÏóµÄ·´ÐòÁл¯¾ÍÊÇ´ÓÊäÈëÁ÷ÖжÁÈ¡¶ÔÏó¡£
ÒªÐòÁл¯µÄ¶ÔÏóÓ¦¸ÃʵÏÖSerializable½Ó¿Ú¡£
Serializable½Ó¿ÚÊÇÒ»¸ö±êʶ½Ó¿Ú£¬Ã»ÓгéÏó·½·¨¡£
SerializableÓÐÒ»¸ö×Ó½Ó¿ÚExternalizable£¬ÊµÏÖExternalizable½Ó¿ÚµÄÀà¿ÉÒÔ×ÔÐпØÖƶÔÏóÐòÁл¯ºÉ·´ÐòÁл¯¹ý³Ì¡£
Ò»°ãÀ´Ëµ£¬Ã»ÓбØÒª×Ô¼ºÊµÏÖÐòÁл¯½Ó¿Ú£¬Ö±½Ó½»¸øJavaÐéÄâ»úÊÇÉϲߡ£
ʵÏÖÁËÐòÁл¯½Ó¿ÚµÄÀ࣬Èç¹ûÆä³ÉÔ±²»ÐèÒªÐòÁл¯½øÈ¥£¬ÔòʹÓÃtransient¹Ø¼ü×Ö½øÐÐÐÞÊΡ£
ÏÂÃæ¸ø³ö¸öÀý×Ó£º
import java.io.*;
/**
* Java¶ÔÏóµÄÐòÁл¯²âÊÔ
* File: ObjectStreamTest.java
* User: leizhimin
* Date: 2008-3-12 20:41:43
*/
public class ObjectStreamTest {
public static void main(String args[]) {
testObjectSeri();
testObjectInSeri();
}
/**
* ¶ÔÏóÐòÁл¯²âÊÔ
*/
public static void testObjectSeri() {
Person person = new Person("ÈÛÑÒ", "341022225562156", "lavasoft");
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputSt
Ïà¹ØÎĵµ£º
JavaÌṩÁËÊýÖÖ³ÖÓжÔÏóµÄ·½Ê½£¬°üÀ¨ÓïÑÔÄÚÖõÄArray£¬»¹ÓоÍÊÇutilitiesÖÐÌṩµÄÈÝÆ÷Àà(container
classes)£¬ÓÖ³ÆÈº¼¯Àà(collection classes)¡£¼¯ºÏÔÚjavaÖзdz£ÖØÒª£¬ÔÚÌÖÂÛ֮ǰ£¬ÏÈÀ´¿´¼¸¸öÃæÊÔÖеľµäÎÊÌâ¡£
1 Collection ºÍ
CollectionsµÄÇø±ð¡£
2 List, Set, MapÊÇ·ñ¼Ì³Ð×ÔCollection½Ó¿Ú¡£ ......
Java³ÌÐòµÄÔ´´úÂëºÜÈÝÒ×±»±ðÈË͵¿´¡£Ö»ÒªÓÐÒ»¸ö·´±àÒëÆ÷£¬ÈκÎÈ˶¼¿ÉÒÔ·ÖÎö±ðÈ˵ĴúÂë¡£±¾ÎÄÌÖÂÛÈçºÎÔÚ²»ÐÞ¸ÄÔÓгÌÐòµÄÇé¿öÏ£¬Í¨¹ý¼ÓÃܼ¼Êõ±£»¤Ô´´úÂë¡£
ΪʲôҪ¼ÓÃÜ£¿
¶ÔÓÚ´«Í³µÄC»òC++Ö®ÀàµÄÓïÑÔÀ´Ëµ£¬ÒªÔÚWebÉϱ£»¤Ô´´úÂëÊǺÜÈÝÒ׵ģ¬Ö»Òª²»·¢²¼Ëü¾Í¿ÉÒÔ¡£Òź¶µÄÊÇ£¬Java³ÌÐòµÄÔ´´úÂëºÜÈÝÒ×±»±ðÈË͵¿´¡£Ö»ÒªÓÐÒ»¸ ......
×î½üÔÚѧJAVA£¬Á·Ï°µÄʱºòÓöµ½¸öÎÊÌ⣬Çë´ó¼Ò°ïæ¿´¿´……
Ö÷ÒªÎÊÌâÊÇ£¬ÔÚJSPÖÐûÓа취µ¼ÈëÎÒÏëÓõÄÀ࣬Ã÷Ã÷µ¼ÈëÁ˰ü£¬È´±¨£ºMyDAO cannot be resolved to a type
JSP´úÂ룺
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.t ......
/////////////////////DogTestDrive/////////////////////
class DogTestDrive {
public static void main(String[] args) {
Dog one = new Dog();
one.size = 70;
Dog two = new Dog();
two.size = 8;
......
±¾ÎÄΪԴ´£¬ÈçÐè×ªÔØ£¬Çë×¢Ã÷×÷Õߺͳö´¦£¬Ð»Ð»£¡
Ëõ·ÅͼÏñµÄ»ù±¾ÔÀíÊÇ´´½¨Ò»¸öÄ¿±ê´óСµÄ»²¼£¬È»ºó¶ÁȡԴͼÏñ£¬²¢½«¸ÃͼÏñ»æÖÆÕâ¸ö»²¼ÉÏ¡£ÎªÁËʹ³ÌÐòͨÓã¬Ô´Í¼ÏñºÍËõ·ÅºóµÄÄ¿±êͼÏñÓ¦Ó÷ֱðʹÓà InputStreamºÍOutputStreamÀ´±íʾ£¬´úÂëÈçÏ£º
public stat ......