这个程序没问题,但是上面帖子的问题要用到这个
------------------------------------------
// DBPair.javaimport java.util.*;
import java.io.*;/*
Stores a key/value String pair in lowercase form.
Supports a "contains" operation to compare bindings.
*/
class DBPair {
private String key;
private String value;
/*
Constructor -- stores the strings, but in lowercse.
*/
public DBPair(String key, String value) {
this.key = key;
this.value = value;
}
/*
True if we contain the given binding.
The keys must match exactly, but the contained value
may just be a substring of our value.
*/
public boolean contains(DBPair contained) {
if(key.equals(contained.key) && value.equals(contained.value))
return true;
else
return false;
}
/*
Provided function to write out a single binding as line of text.
*/
public void write(PrintStream out) {
out.print(key);
out.print('\t');
out.println(value);
}
}
------------------------------------------
// DBPair.javaimport java.util.*;
import java.io.*;/*
Stores a key/value String pair in lowercase form.
Supports a "contains" operation to compare bindings.
*/
class DBPair {
private String key;
private String value;
/*
Constructor -- stores the strings, but in lowercse.
*/
public DBPair(String key, String value) {
this.key = key;
this.value = value;
}
/*
True if we contain the given binding.
The keys must match exactly, but the contained value
may just be a substring of our value.
*/
public boolean contains(DBPair contained) {
if(key.equals(contained.key) && value.equals(contained.value))
return true;
else
return false;
}
/*
Provided function to write out a single binding as line of text.
*/
public void write(PrintStream out) {
out.print(key);
out.print('\t');
out.println(value);
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货