| | |
finding the length in java
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
>I need to find out if the length of the integer (string) is less than 5 digits.
Um...
Um...
if ( s.length() >= 5 ) {
// Proceed
} I'm here to prove you wrong.
•
•
•
•
Originally Posted by webmasts
Hi,
I'm creating a palindrome program. So far, I got that part. Now, I need to find out if the length of the integer (string) is less than 5 digits. If the length is less than 5, then don't proceed with the program. Please give your suggestions. Thanks!
-Or is this a GUI problem?Anyway if you have further problems post this in the java forum.
*Voted best profile in the world*
•
•
Join Date: Feb 2006
Posts: 21
Reputation:
Solved Threads: 0
Actually, I tried using the above code for finding the length, but it doesn't work. Anyways, I will try again. I get the following error:
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at _uesJavaRun.main(_uesJavaRun.java:29)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 4
at java.lang.String.charAt(String.java:558)
at palindrome.main(palindrome.java:26)
... 5 more
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at _uesJavaRun.main(_uesJavaRun.java:29)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 4
at java.lang.String.charAt(String.java:558)
at palindrome.main(palindrome.java:26)
... 5 more
![]() |
Similar Threads
- Counting Alphabet Characters, Words, and String Length! (C)
- need guidence (Java)
- Finding length (Java)
- java in mandrake linux 10.0 help (Java)
- Thinking OOP!: From BASIC to JAVA (Java)
- help required for implementing project using JAVA & XML (Java)
Other Threads in the Computer Science Forum
- Previous Thread: Cropping Tool Build Required
- Next Thread: wat list???
| Thread Tools | Search this Thread |
ai algorithm algorithms amazon assignment assignmenthelp assignments automata battery bigbrother binary bittorrent bizarre bletchleypark blogging business cern codebreaker compiler computer computers computerscience computertrackingsoftware connect conversion csc dataanalysis dataintepretation development dfa dissertation dissertations dissertationthesis dissertationtopic ebook employment energy floatingpoint foreclosure foreclosuresoftware fuel gadgets geeks givemetehcodez government graphics hardware history homeowners homeworkassignment humor ibm idea ideas internet iphone ipod itcontracts jobs kindle laser laws lsmeans mainframes marketing mobileapplication msaccess nano netbeans networking news os p2p piracy piratebay principles programming rasterizer research sam-being-cute sas science security sex simulation software spying stephenfry study supercomputer supercomputing sweden technology textfield turing turingtest two'scompliment uk virus ww2






