CS计算机代考程序代写 Java import java.io.FileReader;

import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;

public class CountHeaders {
public static void main(String[] args) {

try (BufferedReader br =
new BufferedReader(new FileReader(“test.html”))) {

String text;

int count = 0;

while ((text = br.readLine()) != null) {
count = text.contains(“

“) ? count + 1 : count;
}

System.out.println(“# Headers: ” + count);
} catch (Exception e) {
e.printStackTrace();
}

}
}