JAVA高手帮我解决一下这个代码问题
packagecom.bojo;packagecom.db.*;importjava.sql.*;publicclassStudent{privatestringxh;p...
package com.bojo;
package com.db.*;
import java.sql.*;
public class Student
{ private string xh;
private string xm;
private string xb;
private string sr;
public string xh;
{
return xh;
}
public string xm;
{
return xm;
}
public string xb;
{
return xb;
}
public string sr;
{
return sr;
}
public void setXh(String xh)
{
this.xh=xh;
}
public void setXm(String xm)
{
this.xm=xm;
}
public void setXb(String xb)
{
this.xb=xb;
}
public void setSr(String sr)
{
this.sr=sr;
}
public int add()
{
DBUtil db=new DBUtil();
String sql="insert into t_student(xuehao,xingming,xingbie,shengri) values('"+xh+"','"+xm+"','"+xb+"','"+sr+"')";
return db.execuUpdate(sql);
}
public int del()
{
DBUtil db=new DBUtil();
String sql="delete from t_student xuehao='"+xh+"'";
return db.execuUpdate(sql);
}
public int edit()
{
DBUtil db=new DBUtil();
String sql="";
return db.execuUpdate(sql);
}
public ResultSet getAll()
{ DBUtil db=new DBUtil();
String sql="select * from t_student where xuehao='"+xh+"'" ;
return db.execuQuery(sql);
}
}
编译提示 需要为class interface或enum```什么意思? 展开
package com.db.*;
import java.sql.*;
public class Student
{ private string xh;
private string xm;
private string xb;
private string sr;
public string xh;
{
return xh;
}
public string xm;
{
return xm;
}
public string xb;
{
return xb;
}
public string sr;
{
return sr;
}
public void setXh(String xh)
{
this.xh=xh;
}
public void setXm(String xm)
{
this.xm=xm;
}
public void setXb(String xb)
{
this.xb=xb;
}
public void setSr(String sr)
{
this.sr=sr;
}
public int add()
{
DBUtil db=new DBUtil();
String sql="insert into t_student(xuehao,xingming,xingbie,shengri) values('"+xh+"','"+xm+"','"+xb+"','"+sr+"')";
return db.execuUpdate(sql);
}
public int del()
{
DBUtil db=new DBUtil();
String sql="delete from t_student xuehao='"+xh+"'";
return db.execuUpdate(sql);
}
public int edit()
{
DBUtil db=new DBUtil();
String sql="";
return db.execuUpdate(sql);
}
public ResultSet getAll()
{ DBUtil db=new DBUtil();
String sql="select * from t_student where xuehao='"+xh+"'" ;
return db.execuQuery(sql);
}
}
编译提示 需要为class interface或enum```什么意思? 展开
2个回答
展开全部
public string xh;
{
return xh;
}
public string xm;
{
return xm;
}
public string xb;
{
return xb;
}
public string sr;
{
return sr;
}
改为拍闷猜get方法罩掘:袭型
public string getXh()
{
return xh;
}
public string getXm()
{
return xm;
}
public string getXb()
{
return xb;
}
public string getSr()
{
return sr;
}
{
return xh;
}
public string xm;
{
return xm;
}
public string xb;
{
return xb;
}
public string sr;
{
return sr;
}
改为拍闷猜get方法罩掘:袭型
public string getXh()
{
return xh;
}
public string getXm()
{
return xm;
}
public string getXb()
{
return xb;
}
public string getSr()
{
return sr;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询