B
BK
Hello!
I am using the split method to tokenize a string instead of the
StringTokenizer method. The program compiles without any problem.
When executing it is giving the error:
Exception in thread "main" java.lang.NoSuchMethodError
at Test2.main(Test2.java:11)
I would really appreciate it if someone can help me fix this error.
This is the program that I am executing:
import java.io.*;
import java.util.*;
class Test2
{
public static void main(String[] args)
{
try
{
String s = "A B C DE FGH";
String[] result = s.split("\\s");
for (int i=0; i<result.length ; i++)
{
System.out.println(result);
}
//StringTokenizer result = new StringTokenizer("10:27A 04/06
09664 **");
//while (result.hasMoreTokens()) {
//System.out.println(result.nextToken());
//}
}
catch (Exception e)
{
}
}
}
Thanks
I am using the split method to tokenize a string instead of the
StringTokenizer method. The program compiles without any problem.
When executing it is giving the error:
Exception in thread "main" java.lang.NoSuchMethodError
at Test2.main(Test2.java:11)
I would really appreciate it if someone can help me fix this error.
This is the program that I am executing:
import java.io.*;
import java.util.*;
class Test2
{
public static void main(String[] args)
{
try
{
String s = "A B C DE FGH";
String[] result = s.split("\\s");
for (int i=0; i<result.length ; i++)
{
System.out.println(result);
}
//StringTokenizer result = new StringTokenizer("10:27A 04/06
09664 **");
//while (result.hasMoreTokens()) {
//System.out.println(result.nextToken());
//}
}
catch (Exception e)
{
}
}
}
Thanks