This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I get java.lang.NoSuchMethodError when using split(String) function in java.lang.String. This is the code I used. String str="1:2:3"; String arr=new String; arr=str.split(":"); // gettting exception at this line When I checked the syntax it seems to be exactly correct. Dont understand the reason for this error. Can anyone please help me out? Thanks, Uma.
Hi, Welcome to JavaRanch! NoSuchMethodErrors happen when a method that was defined when you compiled your code isn't available when you run your code. This can happen when you compile with a newer JDK than you use at runtime. The String.split() methods were introduced in JDK 1.4; so I imagine you're using a recent JDK to compile your code, and something older at runtime. Either upgrade the runtime environment, or don't use the regexp stuff.