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

JAVAÐòÁл¯µÄÁ½ÖÖ·½Ê½¡¾×ªÌù¡¿

JAVAÐòÁл¯µÄÁ½ÖÖ·½Ê½
//´ó¼Ò¶¼ÖªµÀSerializableÊÇÒ»¸ömark interface,¸æËßJVMÕâ¸ö¶ÔÏó¿ÉÒÔ±»×ª»»³É¶þ½øÖÆÁ÷À´´«Êä.
//Serializable ÔÚÎÒÃÇʵÏÖÕâ¸ö½Ó¿ÚµÄʱºò,ÎÒÃÇ¿ÉÒÔʹÓÃ4¸ö˽Óз½·¨À´¿ØÖÆÐòÁл¯µÄ¹ý³Ì:
//ÎÒÃÇÀ´¿´Ò»¸öÀý×Ó:
public class FooImpl implements java.io.Serializable
{
private String message;
public String getFoo()
{
return message;
}
public void setMessage( String message )
{
this.message = message;
}
private void writeObject( java.io.ObjectOutputStream out ) throws IOException
{
System.out.println( "writeObject invoked" );
out.writeObject( this.message == null ? "hohohahaha" : this.message );
}
private void readObject( java.io.ObjectInputStream in ) throws IOException, ClassNotFoundException
{
System.out.println( "readObject invoked" );
this.message = (String) in.readObject();
}
private Object writeReplace() throws ObjectStreamException
{
System.out.println( "writeReplace invoked" );
return this;
}
private Object readResolve() throws ObjectStreamException
{
System.out.println( "readResolve invoked" );
return this;
}
public Object serialize() throws IOException, ClassNotFoundException
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream( baos );
oos.writeObject( this );
ByteArrayInputStream bais = new ByteArrayInputStream( baos.toByteArray() );
ObjectInputStream ois = new ObjectInputStream( bais );
return ois.readObject();
}
public static void main(String[] args) throws IOException, ClassNotFoundException
{
FooImpl fooimpl = new FooImpl();
fooimpl.se


Ïà¹ØÎĵµ£º

javaʹÓÃrocksawºÍvserv tcpipʵÏÖ»ùÓÚICMPµÄPing¹¦ÄÜ

Ò»£º×¼±¸ www.savarese.org download
 1.  rocksaw-1.0.0-src.tar.gz
 2.  vserv-tcpip-0.9.2-src.tar.gz
¶þ£º±àÒëÔ´ÎļþµÃµ½jar°ü ʹÓÃAnt
 1.  build vserv-tcpip-0.9.2-src
      ÔÚvserv-tcpip-0.9.2Ŀ¼ÏÂÃæ½¨Ò»¸ötestsĿ¼£¬È»ºóÔÚcmd´°¿ÚϽøÈë ......

ÈçºÎʹÓÃJavaÖеÄDateºÍCalendarÀà

Java ÓïÑÔµÄCalendar(ÈÕÀú),Date(ÈÕÆÚ), ºÍDateFormat(ÈÕÆÚ¸ñʽ)×é³ÉÁËJava±ê×¼µÄÒ»¸ö»ù±¾µ«ÊǷdz£ÖØÒªµÄ²¿·Ö. ÈÕÆÚÊÇÉÌÒµÂß¼­¼ÆËãÒ»¸ö¹Ø¼üµÄ²¿·Ö. ËùÓеĿª·¢Õß¶¼Ó¦¸ÃÄܹ»¼ÆËãδÀ´µÄÈÕÆÚ, ¶¨ÖÆÈÕÆÚµÄÏÔʾ¸ñʽ, ²¢½«Îı¾Êý¾Ý½âÎö³ÉÈÕÆÚ¶ÔÏó. ÎÒÃÇдÁËÁ½ÆªÎÄÕÂ, ÕâÊǵÚһƪ, Î ......

javaÖе±Ç°Â·¾¶ Ïà¶Ô·¾¶

public class FilePath {
  public void Print() {
   String a = this.getClass().getClassLoader().getResource(".").getPath();
   String b = this.getClass().getResource("").getPath();
   String c = this.getClass().getResource(" ").getPath();
&n ......

java×°ÏäÓë²ðÏä

/**
* ==ºÅÊDZȽÏÁ½¸ö»ù±¾ÀàÐÍÊÇ·ñÏàµÈ,»òÕ߱ȽÏÁ½¸ö¶ÔÏóÒýÓÃÊÇ·ñÏàͬ
*/
public class T {

public static void main(String[] args) {
Integer i1 = 128;
Integer i2 = 128;
int i3 = 128;
int i4 = 128;
Integer i5 = 127;
Integer i6 = 127; ......

java±à³ÌÎļþ¿½±´

import java.io.FileInputStream;
public class FileCopy{
      public static void main(String[] args){
                  try{
         &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ