Dear Mr. Pig, just for your reference

jabber (jabber)
The following is the code that may be useful to some people. My code is not polished. If you are a coding expert, please do not comment on the stupidness in my code. Thank you.

import java.io.*;

public class FileCount{

private static int javacount=0;

public static void main(String[] args) throws Exception{
if(args.length !=1) {
System.out.println("usge: java FileCount <dir>");
File file = new File(args[0]);
System.out.println("There are " + javacount + " java files under "+ args[0]);


private static void count(File f)throws Exception{
File list[] = f.listFiles();
for(int i=0; i<list.length; i++) {
if(list[i].isDirectory()) {
} else{
String s = list[i].getName();
int index = s.indexOf(".java");
if(index !=-1) {


2001-8-23 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: Jabber's English Note---035

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习English