Results 1 to 2 of 2
Thread: How to get part of a String?
- 12-22-2007, 12:30 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 49
- Rep Power
- 0
How to get part of a String?
I have following code which produces the required output:
Java Code:String fileNameWithExt = "interface_for_database_18sep07.txt"; String fileName = fileNameWithExt.substring(0, 30); System.out.println(fileName);
Java Code:interface_for_database_18sep07
java.lang.StackOverflowError
I have written a recursive module and I get java.lang.StackOverflowError. I got some output before this exception. I want to know after how much iteration this exception is raised. Wont Java compiler identify this recursive statement at compile time?
- PEACE
- 12-23-2007, 07:58 AM #2Java Code:
String fileNameWithExt = "interface_for_database_18sep07.txt"; int dot = fileNameWithExt.indexOf("."); String fileName = fileNameWithExt.substring(0, dot); System.out.println(fileName);
Depends on how you have set up your method. I would try to use some println statements to track what you think should be happening as it recurses.
Wont Java compiler identify this recursive statement at compile time?
Probably not; depends on what you wrote. Your code can compile okay and create all kinds of problems at runtime.
Similar Threads
-
Inventory part 2 help please
By badness in forum New To JavaReplies: 1Last Post: 12-12-2007, 08:51 AM -
Help with mathematical part in java
By lenny in forum Advanced JavaReplies: 3Last Post: 08-09-2007, 02:55 PM
Bookmarks