Topic: 谁能帮我看看这个程序怎么没有效果啊 |
Print this page |
1.谁能帮我看看这个程序怎么没有效果啊 | Copy to clipboard |
Posted by: kyosold Posted on: 2005-04-26 13:19 import java.io.*; import java.awt.*; public class Kyo extends Frame{ public TextArea ta; public void Kyo() { initPage(); fileReader("D:\\aa.txt"); } public void initPage() { ta=new TextArea("",0,0,TextArea.SCROLLBARS_VERTICAL_ONLY); add(ta,"Center"); } public void fileReader(String path) { File f=new File(path); StringBuffer sb=new StringBuffer(); FileReader fr=null; BufferedReader br=null; try{ fr=new FileReader; br=new BufferedReader(fr); String line=br.readLine(); while(line!=null) { sb.append(line); line=br.readLine(); } } catch(Exception e){e.printStackTrace(); } finally{ if(fr!=null)try{fr.close(); }catch(Exception e){ } if(br!=null)try{br.close(); }catch(Exception e){ } } System.out.println("sb"); ta.setText(new String(sb)); } public static void main(String args[]) { Kyo k=new Kyo(); k.setBounds(100,100,600,400); k.setVisible(true); } } 哪里出了错,System.out.println("aa");都不行 |
2.Re:谁能帮我看看这个程序怎么没有效果啊 [Re: kyosold] | Copy to clipboard |
Posted by: danzel Posted on: 2005-04-26 16:05 public Kyo() { initPage(); fileReader("D:\\aa.txt"); } |
3.Re:谁能帮我看看这个程序怎么没有效果啊 [Re: kyosold] | Copy to clipboard |
Posted by: xieminyu Posted on: 2005-04-27 11:03 Kyo.java:24: '(' or '[' expected fr=new FileReader; ^ 1 error |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |