当前位置: 技术问答>java相关
请问哪里错了?在线等......等......
来源: 互联网 发布时间:2015-08-29
本文导语: 错误: Note: test.java uses or overides a deprecated API. Note: Recompile with -deprecation for details. 程序代码: import java.awt.*; public class test extends Frame{ public String motd; public test(String s) { super("Java 基本...
错误:
Note: test.java uses or overides a deprecated API.
Note: Recompile with -deprecation for details.
程序代码:
import java.awt.*;
public class test extends Frame{
public String motd;
public test(String s)
{
super("Java 基本框架Frame");
motd=s;
resize(300,300);
}
public test()
{
this("this is a test");
}
public void paint(Graphics g)
{
g.drawString(motd,15,15);
g.drawString("click anywhere Exit",15,25);
}
public void start()
{
show();
}
public boolean mouseDown(Event e,int x,int y){
hide();
dispose();
System.exit(0);
return false;
}
public static void main(String args[]){
test m;
if (args.length>0)
{
m=new test(args[0]);
}
else {
m=new test();
}
m.start();
}
}
Note: test.java uses or overides a deprecated API.
Note: Recompile with -deprecation for details.
程序代码:
import java.awt.*;
public class test extends Frame{
public String motd;
public test(String s)
{
super("Java 基本框架Frame");
motd=s;
resize(300,300);
}
public test()
{
this("this is a test");
}
public void paint(Graphics g)
{
g.drawString(motd,15,15);
g.drawString("click anywhere Exit",15,25);
}
public void start()
{
show();
}
public boolean mouseDown(Event e,int x,int y){
hide();
dispose();
System.exit(0);
return false;
}
public static void main(String args[]){
test m;
if (args.length>0)
{
m=new test(args[0]);
}
else {
m=new test();
}
m.start();
}
}
|
mouseDown 和 resize方法不建议使用,是警告不是错误。
|
俺测试了一下,你的程序可以运行啊!