Problem with pageFetcher
for(int i = 0; i开发者_JAVA技巧 < citylink.length; i++) { body=pF.fetchpage(citylink[i][1]); // It's for taking the url from the table citylink // and returns the source of this url!
I have also declared it in my pagefetcher.java
class like this:
public String fetchPage(String url) {
try {
url = URIUtil.encodeQuery(url);
} catch (URIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
but when I compile it it says that the method fetchpage(String)
is undefined for the type PageFetcher
and I can't run my problem! I don't know what to do.
Your method needs to return a string. The method is declared as a public String, but fails to return the value you want (url)
You declare your code as
public String fetchPage(String url) {
And call it as
body=pF.fetchpage(citylink[i][1]);
Java is case sensitive: you should rename either of them to match eachother.
精彩评论