i compiled this as javac yes.java , and it does compiled! but when i run it as yes java "test" ,it goes back again to compilation! there's no output on the screen that I am waiting to view from it..Help me please to run this program and to see the output! Maybe there's a problem with my codes. Please debug also! :-D
Here's the java source code(program):
class yes{
public static void main(String [] args){
String s = args[0];
int[] f = tally(s);
}
static int[] tally(String s){
int[] f = new int[26];
s = s.toUpperCase();
for(int i=0; i
char ch = s.charAt(i);
if (Character.isLetter(ch)){
int j = ch - 'A';
++f[j];
}
}
return f;
}
static void print(int[] f){
for(int j=0; j
char ch = (char)(j+'A');
if (f[j]>0)
System.out.println(ch +": "+f[j]);
}
}
}
2007-07-10
01:55:02
·
4 answers
·
asked by
mjmg
1
in
Computers & Internet
➔ Programming & Design