为什么这个程序不返回值?

zdblzwj zdblzwj 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.Writer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class GetPageCount {
public int getPageCount() throws IOException{
BufferedReader reader=new BufferedReader(new FileReader("E:\\jsp\\test.txt"));
String line=reader.readLine();
int i = 0;
while(line!=null){
line = reader.readLine();
String r1="(.*共 <span class=\"text_orange\">)(.*)(</span> 页.*)";
Pattern s1=Pattern.compile(r1);
Matcher m1=s1.matcher(line);
boolean T1=m1.matches();
if(T1)
{
i=Integer.parseInt(m1.group(2)) ;
System.out.println("--------总页数-------:"+i);//这儿输出I有值
}

}
return i;
}

}

为什么不返回值呢?我测试的时候好像根本就没有执行return i
...全文
评论 10
收藏 已收藏
分享
返回顶部
zdblzwj
Java SE 62,620 成员 307,251 内容