Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Threads Program

Thread view: 
nish - 01 Apr 2007 04:38 GMT
Hello friends,
                       I am new to Java and I need your help in doing
these thread programs

1) Create 2 threads. First thread provides a string to the second
which checks whether the given string is a palindrome or not.

2) Write an applet program which has 2 buttons called increase and
decrease on the system thread. The child thread should display a line
numbers from 1 to 30 and back to 1 displaying different positions.
When the increase button is clicked, the sleep thead increase and an
action on the decrease button should decrease the sleep time of the
thread.

Looking forward to your suggestions

THanks

Nish
Andrew Thompson - 01 Apr 2007 07:44 GMT
> Hello friends,

My friends would not multi-post.
<http://www.physci.org/codes/javafaq.html#xpost>

(X-post to c.l.j.p./g., w/ f-u to c.l.j.g. only)

Andrew T.
nvpkdp - 05 Apr 2007 05:02 GMT
My primary motivation for replying to this thread(and perhaps the only
one) is my weird interest in palindromes...
I probably can't help you much directly, as I've been out of Java for
awhile and only now just trying to get back into this wonderful
programming language, ... but at least this gives me the opportunity to
show off some of my own palindromes you might try on your program,
if/when you get it working.

> Hello friends,
>                         I am new to Java and I need your help in doing
> these thread programs
>
> 1) Create 2 threads. First thread provides a string to the second
> which checks whether the given string is a palindrome or not.

O.K. So your "these thread programs" provide the performance you
perceive as necessary to a search for palindromes?  I could only
understand such an undertaking as an academic exercise, which I presume
it is.
> 2) Write an applet program which has 2 buttons called increase and
> decrease on the system thread. The child thread should display a line
> numbers from 1 to 30 and back to 1 displaying different positions.
> When the increase button is clicked, the sleep thead increase and an
> action on the decrease button should decrease the sleep time of the
> thread.

O.K.., if I understand you correctly...  I'm hardly an expert on
threads, nor on Java in general for that matter, but it seems unlikely
to me that some thread you spawned in your program could influence the
main thread begun by the java interpreter when it executed your program
beginning with its "main" function. And even if you could, wouldn't all
its children sleep too?

In any case, if you need to do something sophisticated with thread
programming you might try:

Java Threads by Scott Oaks and Henry Wong

O.K. Now for the Palindromes:

I'll quote some of the famous ones you all probably already know:

From Napoleon after his defeat at Waterloo and exile to the island of
Elba in the Mediterranean:

Able was I, ere I saw Elba.

Another palindrome from antiquity:

Madam I'm Adam.

More recent:

Dennis sinned.

if

fi

(Bash script)

Some of my own:

A Toyota

Fool aloof

My Gym

Loot a tool

Wolf flow

Not a Photon  (Well, almost, were it not for ridiculous spellings in
the English language)

Russian, on the other hand, while worlds away from English in both
pronunciation and grammar, has a completely logical and for the most
part phonetic system.

At any rate, a nice way to extend the exercise might be to find/verify
palindromes in other languages, as Java was built from the ground up to
work with any language.

Enough to keep any Text Processing Geeks busy.

  --Dooshe


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.