Computing.Net > Forums > Programming > Java JTextArea

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java JTextArea

Reply to Message Icon

Name: Dado
Date: October 21, 2004 at 18:22:37 Pacific
OS: Win XP
CPU/Ram: 512MB
Comment:

Using Java: I am inputting a string in a text field (consisting of numbers only), and then I would like to find all the even numbers in the string when a button to find the even numbers is pressed and display them in a text area, and find all the odd numbers in the string when a button to find the odd numbers is pressed and display them in a text area. How would I go about doing this?
Help is appreciated! (Note: I'm new to Java)



Sponsored Link
Ads by Google

Response Number 1
Name: jubalsams
Date: October 21, 2004 at 20:49:16 Pacific
Reply:

Well, i don't know java either but the general method would be:
1. scan in the string up to the next digit.
2. grab the digit and convert it to a number
eg '2'=2 and so on.
3. use the MODULO 2 function ... it will be zero for even number and 1 for odd number. Test it and place in correct output position.
4. go to 1.

Best


0
Reply to Message Icon

Related Posts

See More


Need help with batch file ASM Understanding Code He...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Java JTextArea

Help wit a little Java program www.computing.net/answers/programming/help-wit-a-little-java-program-/94.html

java arrays www.computing.net/answers/programming/java-arrays/10359.html

Java TextArea question www.computing.net/answers/programming/java-textarea-question/14574.html