1
Java / Java Character counter from txtfile
« on: June 20, 2014, 12:18:14 pm »
This code have error somewhere around dnt knw what to do next
Please help me out
Please help me out
Code: [Select]
Import java.io.*;
Import java.util.Scanner;
Public class txtCharacter{
Public static Scanner kb = new Scanner;
Public static void main(String args[])throws IOException{
. Scanner in = new Scanner(new FileReader("file locatio");
char Character;
System.out.println("Enter character to count");
Character = kb.nextLineCharAt(0);
while(in.hasNext){
. String line = in.readLine();
. int count;
if(Character=!' '){
counter++;
}
}
System.out.println("The number of occurrence: "+ count);
}
In.close();
}