| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 610 人关注过本帖
标题:[求助]两个有难度的问题!请教!!!
取消只看楼主 加入收藏
l54515429
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2005-12-22
收藏
 问题点数:0 回复次数:0 
[求助]两个有难度的问题!请教!!!

各位大哥大姐,小弟我又遇到问题了。我用的是JSDK
在书上扒下来的程序清单怎么也能出错?
还要请各位帮下忙!

程序清单testDigest

import java.io.*;
import java.security.*;

public class testDigest{
/**----------------------------------------
*<br>功能概述:测试摘要流
-----------------------------------------*/
public void testOperate(){
try{
MessageDigest sha = MessageDigest.getInstance("SHA");
DigestOutputStream dos = new DigestOutputStream(System.out,sha);

byte buffer[] = new byte[128];
while(true){
int byteRead = System.in.read(buffer);
if(byteRead<0) break;
dos.write(buffer,0,byteRead);
}
dos.flush();
dos.close();
}
catch(IOException e){}
}//testoperate()

public static void main(String args[]){
testDigest td = new testDigest();
td.testOperate();
}//main()
}/**testDigest*/

不能生成.class文件 错误是
testDigest.java:10: unreported exception java.security.NoSuchAlgorithmException;
must be caught or declared to be thrown
MessageDigest sha = MessageDigest.getInstance("SHA");
^

程序清单testWindowListener

import javax.swing.*;
import java.awt.event.WindowListener;
import java.awt.event.WindowEvent;

public class testWindowListener extends JFrame implements WindowListener{
public testWindowListener(){
super("testWindowListener");
setSize(300,100);
this.addWindowListener(this);
}//testWindowListener()

public void log(String strInfo){
System.out.println(strInfo);
}//log()
/**---------------------------------------------
*<br>功能概述:实现窗口事件接口中的方法
----------------------------------------------*/
public void windowActivated(WindowEvent e){
log("窗口被激活...");
}//windowActivated()

public void windowClosed(WindowEvent e){
log("窗口关闭之后...");
}//windowClosed()

public void windowClosing(WindowEvent e){
log("关闭过程中...");
}//windowClosing()

public void windowDeactivated(WindowEvent e){
log("窗口不在处于激活状态时...");
}//windowDeactivated()

public void windowDeiconifieded(WindowEvent e){
log("窗口大小从最小到正常时...");
}//windowDeiconifieded()

public void windowIconified(WindowEvent e){
log("窗口大小从正常到最小时...");
}//windowIconified()

public void windowOpened(WindowEvent e){
log("窗口第一次被打开时...");
}//windowOpened()

public static void main(String args[]){
testWindowListener twl = new testWindowListener();
twl.show();
}//main()
}/**testWindowListener*/

不能生成.class文件 错误是
testWindowListener is not abstract and does not override abstract method
windowDeiconified(java.awt.event.WindowEvent) in java.awt.event.WindowListener


好象不是因为打错字,我检查好几遍了。谁能帮我看一下,我脑袋都大了!

[此贴子已经被作者于2005-12-27 19:54:36编辑过]

搜索更多相关主题的帖子: 难度 
2005-12-27 19:54
快速回复:[求助]两个有难度的问题!请教!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014752 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved