Author
String's split() -- gives compilation error
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1303
String [] result1 = "hai how".split("\\s"); for (int x=0; x<result1.length; x++) System.out.println(result1[x]); When i tried to compile this, i got the follwing error? cannot resolve symbol symbol : method split (java.lang.String ) location: class java.lang.String String[] result1 = "hai how".split("\\s"); ^ 1 error
Abhinay Verma
Greenhorn
Joined: Dec 13, 2004
Posts: 24
It is working and not giving compilation errors. The code gave the following output: hai how Which version of J2SE are you using?
K Riaz
Ranch Hand
Joined: Jan 08, 2005
Posts: 375
posted Mar 28, 2005 05:03:00
0
Fine for me also. Do a "java -version".
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
String.split() is not in version 1.3. It's available only from V1.4
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
kri shan
Ranch Hand
Joined: Apr 08, 2004
Posts: 1303
Mine is jdk 1.3. What is the equivalent method in jdk 1.3?
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
You can use substring() and try to implement it.
K Riaz
Ranch Hand
Joined: Jan 08, 2005
Posts: 375
posted Mar 28, 2005 06:44:00
0
Or StringTokenizer . Or upgrade.
subject: String's split() -- gives compilation error