Article View: cn.bbs.comp.lang.java
Article #24125������������̣���������������
From: ���Ƶ�yoyo
Date: Mon, 27 Apr 1998 00:00
Date: Mon, 27 Apr 1998 00:00
79 lines
2470 bytes
2470 bytes
import java.io.*;
import java.applet.*;
import java.awt.*;
public class test extends Applet
{
StringBuffer buffer=new StringBuffer();
int i
public void init()
{
addone();
}
void addone()
{
FileInputStream fi=null;
DataInputStream fin=null;
FileOutputStream fou=null;
DataOutputStream fout=null;
try
{
fi=new FileInputStream("data");//open the file
fin=new DataInputStream(fi);
}
catch(FileNotFoundException e){}
try
{
i=fin.readInt();//get the number
fin.close();
}
catch(IOException e){};
i++;
//File fone=new File("data");
//fone.delete();
File ftwo=new File("data");//open the file again
try
{
fou=new FileOutputStream("data");
}
catch(IOException e){}
fout=new DataOutputStream(fou);
try
{
fout.writeInt(i);//store the number for next time
fout.close();
}
catch(IOException e){}
buffer.append(i);
}
public void start()
{
}
public void paint( raphics g)
{
g.setColor(Color.blue);
g.drawString(buffer.toString(),10,20);
}
}
---------------------------------------------------
it is html for the program
<HTML>
<HEAD>
<TITLE>TEST</TITLE>
</HEAD>
<BODY>
<APPLET CODE="test.class" WIDTH=400 HEIGHT=200>
</APPLET>
</BODY>
<HTML>
�ó���ʹ��֮ǰ�Ƚ���һ��data�ļ����ɡ�����ҵ��Ҫɶ������0.
�������������Ҳ���ܣ��������0��ʼ����
�����м��κ��Ҵ��ļ���������ʾ�İ���������
--
[m[1;36m�� ��Դ:���ϴ�С�ٺ���Ϣ����վ bbs.nju.edu.cn��[FROM: 202.119.44.35][m
Technical Details
Message-ID:
<3OGdPS$7ij@bbs.nju.edu.cn>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f6cb0,4e2328a8a1f95bd5,start X-Google-Attributes: gidf6cb0,public From: yoyo.bbs@bbs.nju.edu.cn (���Ƶ�yoyo) Subject: ������������̣��������������� Date: 1998/04/27 Message-ID: <3OGdPS$7ij@bbs.nju.edu.cn> X-Deja-AN: 348251148 X-Filename: Java/M.893674444.A Organization: nju_bbs Newsgroups: cn.bbs.comp.lang.java