本程序的功能是,根据用户输入的文件名,在相应的文件内容中查找匹配给定模式的字符串,并

题型:问答题

问题:

本程序的功能是,根据用户输入的文件名,在相应的文件内容中查找匹配给定模式的字符串,并将这些字符串显示出来。模式串为“href="…"”。请填写横线处的内容。 注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。 import java.io.*; import java.util.regex.*; import javax.swing.*; public class Example2_10 { public static void main(String [] argv) { final String patternString = "href\\s*=\\s*(\"[^\"]*\"|[^\\s>])\\s*; String fileName ; try { System. out. print ( "请输入html 文件的文件名: "); InputStreamReader in = new InputStreamReader(System.in); BufferedReader imput = new BufferedReader(in); fileName = imput.readLine(); if(fileName.equals(" ")) return; StringBuffer buffer = new StringBuffer(); File file = new File(fileName); FileInputStream readfile = new FileInputStream(file); for(int c = 0; (c = readfile.read()) != -1; ) buffer.append((char)c); Pattern pattern = Pattern.compile( _____________ Pattern.CASE_INSENSITIVE); Matcher matcher =________; while (marcher. find ()) {int start = matcher.start();int end = matcher.end();String match = buffer.substring(start, end);System.out.println (match); } } catch (Exception excption) { System. out.println (excption. getMessage ()); } System.exit(O); } }

考点:计算机等级考试JAVA二级JAVA机试48
题型:问答题

急性感染性多发性神经根炎典型的脑脊液细胞蛋白分离,可出现于病程的什么时间()

A.起病后1~3天内

B.起病后4~7天内

C.起病后1周至1个月

D.起病后1~2个月

E.起病后1~3个月

题型:问答题

SPECT在脑灌注显像中脑梗死灶显示灌注减低区范围较X线、CT为()

A.范围大,且发现早

B.范围小,且发现早

C.范围大,但发现晚

D.范围小,且发现晚

E.范围一样,但发现晚

题型:问答题

Excel表格中输入公式前,应该先输入(),输入“001”应该先输入()

题型:问答题

“花明天的钱,圆今天的梦”,形容的是()

A.钱货两清的消费

B.超前消费

C.租赁消费

D.贷款消费

题型:问答题

患者,女,50岁,诊断为2型糖尿病,遵医嘱皮下注射普通胰岛素4U,下述操作不妥的是()

A.饭前30分钟注射

B.注射部位可选用腹部

C.用2ml注射器抽吸药液

D.用碘酊、乙醇消毒皮肤

E.针头与皮肤成300角进针

更多题库