🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.lang.java
Article #22621

?????���⣡

#22621
From: Mosaic
Date: Mon, 15 Sep 2003 05:40
52 lines
2583 bytes
һ���Ҹ�������ļ���
/*******************************************************
// ReadFile.java
import java.io.*;

public class ReadFile {
 // Filename is declear here
 public String FileName;

 //Default Init ReadFile
 ReadFile(){
  System.out.println("Your must input the name of the file!");
 }
 //Init ReadFile
 ReadFile(String Filename) {
  byte buff[] = new byte[80];
  try {
   InputStream filein = new FileInputStream(FileName);
   int i = filein.read(buff);
   String s = new String(buff);
   System.out.println(s);
   filein.close();
  } catch (FileNotFoundException e) {
   System.out.println("File not found!");
  } catch (IOException e) {
  }
 }
}

/*******************************************************
//ReadFileApp.java
package mosaic;

public class ReadFileApp {

 public static void main(String[] args) {
  String f1 = new String("file1.txt");
  ReadFile rf = new ReadFile(f1);
 }
}
/*******************************************************

��������ڲ���Ĵ��ݣ�Ϊʲô���������ִ��ʱ����ִ���
java.lang.NullPointerException
 at java.io.FileInputStream.open(Native Method)
 at java.io.FileInputStream.<init>(FileInputStream.java:103)
 at java.io.FileInputStream.<init>(FileInputStream.java:66)
 at mosaic.ReadFile.<init>(ReadFile.java:27)
 at mosaic.ReadFileApp.main(ReadFileApp.java:17)
Exception in thread "main"
/******************************************************
���ʸ�λ��Ϻ�������ν����лл
Technical Details
Message-ID: <bk3jac$44m$1@mail.cn99.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news.cn99.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f6cb0,eefa2634dd6e07f4,start
X-Google-Attributes: gidf6cb0,public
X-Google-ArrivalTime: 2003-09-14 22:39:56 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!feed2.newsreader.com!newsreader.com!maily.cic.tsinghua.edu.cn!news.cn99.com!not-for-mail
From: "Mosaic" <mosaic@hotmail.com>
Newsgroups: cn.bbs.comp.lang.java
Subject: ?????���⣡
Date: Mon, 15 Sep 2003 13:40:35 +0800
Organization: Bentium Ltd. (CN99)
Lines: 54
Message-ID: <bk3jac$44m$1@mail.cn99.com>
NNTP-Posting-Host: 218.104.83.172
X-Trace: mail.cn99.com 1063604364 4246 218.104.83.172 (15 Sep 2003 05:39:24 GMT)
X-Complaints-To: usenet@news.cn99.com
NNTP-Posting-Date: Mon, 15 Sep 2003 05:39:24 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106