compile ok!!!!run 老是不出现结果。 你的里面是否有一个无穷循环!如果在命令行下没有结果的话,想重新编译,按ctrl+c 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 代码就是这样了,多谢!!!!!(分已经加完了…………后来者只有以后再谢了!!多包涵???)import java.awt.*;import java.awt.event.*;import java.sql.*;import java.net.*;class Mywin extends Frame implements ActionListener{ TextField name;TextArea text ;Button button ;Panel panel;Mywin(){super("成绩查询");setLayout(new BorderLayout());setBounds(160,160,400,120);name=new TextField(10);button=new Button("确定");text=new TextArea();panel =new Panel();panel.add(new Label("请输入要查询人的姓名"));panel.add(name);panel.add(button);add(panel,"North");add(text,"Center");button.addActionListener(this);addWindowListener(new WindowAdapter(){public void WindowClosing(WindowEvent e ){System.exit(0);}});pack();}public void actionPerformed(ActionEvent e ){ if(e.getSource()==button){ text.setText("查询结果"+"\n");try{Studentlist();}catch(SQLException ee){}} }public void Studentlist() throws SQLException {String xingm;int math,english,sum;try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}catch(ClassNotFoundException ee){}Connection con = DriverManager.getConnection("jdbc:odbc:first","lianxi"," ");Statement stm = con.createStatement();ResultSet set = stm.executeQuery("select * from lianxi");while(set.next()){ xingm = set.getString("姓名"); math = set.getInt("数学");english = set.getInt("英语");sum = math + english;if( (xingm.trim()).equals (name.getText().trim())){ text.append(name+"的成绩结果:"+"\n"+"数学"+math+"*******"+english+"英语"+sum+"总分");}}if((text.getText().trim()).equals ("查询结果")){text.setText("没有该人的成绩");}}}public class xuesheng{ public static void main(String args[]){Mywin mywin = new Mywin();}} java泛型求教 时间处理问题……急啊,请各位大虾指点 Properties类loadXML总出错,为什么?急求啊 JAVA声明变量问题! ip数据库的java程序 子类的构造函数用this 或者super,为什么用this不对啊 哪里能找到做网站的例子? 关于Runtime.exec问题 java 入门 意外类型 学了个很简单的加密,但是解密不会写... 一个关于jar包的问题 怎么设置一个按钮的尺寸?
import java.awt.*;import java.awt.event.*;import java.sql.*;import java.net.*;
class Mywin extends Frame implements ActionListener
{ TextField name;TextArea text ;Button button ;Panel panel;
Mywin()
{super("成绩查询");
setLayout(new BorderLayout());
setBounds(160,160,400,120);name=new TextField(10);button=new Button("确定");text=new TextArea();
panel =new Panel();
panel.add(new Label("请输入要查询人的姓名"));panel.add(name);panel.add(button);
add(panel,"North");add(text,"Center");
button.addActionListener(this);
addWindowListener(new WindowAdapter()
{public void WindowClosing(WindowEvent e )
{System.exit(0);}});
pack();
}public void actionPerformed(ActionEvent e )
{ if(e.getSource()==button)
{ text.setText("查询结果"+"\n");
try{Studentlist();}
catch(SQLException ee){}
}
}
public void Studentlist() throws SQLException
{String xingm;int math,english,sum;
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}
catch(ClassNotFoundException ee){}
Connection con = DriverManager.getConnection("jdbc:odbc:first","lianxi"," ");
Statement stm = con.createStatement();
ResultSet set = stm.executeQuery("select * from lianxi");
while(set.next())
{
xingm = set.getString("姓名"); math = set.getInt("数学");english = set.getInt("英语");
sum = math + english;
if( (xingm.trim()).equals (name.getText().trim()))
{ text.append(name+"的成绩结果:"+"\n"+"数学"+math+"*******"+english+"英语"+sum+"总分");}
}
if((text.getText().trim()).equals ("查询结果"))
{text.setText("没有该人的成绩");}
}
}
public class xuesheng
{ public static void main(String args[])
{Mywin mywin = new Mywin();}}