881507 wrote:Follow the convention to writing a class.
public class tokenize
public class Tokenize
881507 wrote:System.out.println("the no of words in the string s is: "str.countTokens()" and the number of words in s1 is: "+str1.countTokens);is this compiled?
881507 wrote:this is the point which throw the exception.
char c= strpackets.charAt(a);
for( int a=0;a<strpackets.length();a++)
That tell you that in the class 'Caos', at the method 'main', line 20 there where an array and you tried to use a value for the index beyond its capacity. And the value that exceeded it was 1.
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at Caos.main(Caos.java:20)