我编写了以下两个类:
设备.java
class Equipment{
private int id;
private String name;
private String local;
public void setId(int id){
this.id = id;
}
public void setName(String n){
this.name = n;
}
public void setLocal(String l){
this.local = l;
}
public int getId(){
return this.id;
}
public String getName(){
return this.name;
}
public String getLocal(){
return this.local;
}
}
我用这门课进行了测试,效果很好
import java.util.*;
import java.sql.*;
class MainTest{
public static void main(String[] args) throws SQLException {
JDBCCommands jdbc = new JDBCCommands();
//jdbc.Create("Teste novo", "Novo Teste");
for(Equipment c : jdbc.Show()){
System.out.print(c.getId() + " ");
System.out.print(c.getName() + " ");
System.out.print(c.getLocal() + "\n");
}
System.out.println("-------------------------------------");
for(Equipment c : jdbc.Search("est n" , "est")){
System.out.print(c.getId() + " ");
System.out.print(c.getName() + " ");
System.out.print(c.getLocal() + "\n");
}
}
}
HUX布斯
相关分类