Hello friends, I am new to Java and I need your help in doingthese thread programs1) Create 2 threads. First thread provides a string to the secondwhich checks whether the given string is a palindrome or not.2) Write an applet program which has 2 buttons called increase anddecrease on the system thread. The child thread should display a linenumbers from 1 to 30 and back to 1 displaying different positions.When the increase button is clicked, the sleep thead increase and anaction on the decrease button should decrease the sleep time of thethread.Looking forward to your suggestionsTHanksNish
|
|
0
|
|
|
|
Reply
|
nishant.friend (14)
|
4/1/2007 3:38:17 AM |
|
On Apr 1, 1:38 pm, "nish" <nishant.fri...@gmail.com> wrote:> 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.
|
|
0
|
|
|
|
Reply
|
Andrew
|
4/1/2007 6:44:35 AM
|
|
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
|
|
0
|
|
|
|
Reply
|
nvpkdp
|
4/5/2007 4:02:09 AM
|
|
|
2 Replies
102 Views
(page loaded in 0.063 seconds)
Similiar Articles: debugging c program - comp.programming.threadsI am having some problems debugging my program. I am getting a SIGSEGV. I have a linked list. I am reading in data from a text file, storing the dat... How to use 'lock' prefix to make instruction atomic (in a multi ...Hi all, I am writing a multi-threaded assembly program with POSIX threads. There is a global variable that all thread can modify. Each thread may in... Problem with pthreads C++ wrapper class on Linux - comp ...I wrote up a simple C++ wrapper class to encapsulate the (very basic) usage of the ptheads API to create detached threads. My implementation uses a gl... When I debug a multithread program with gdb, and the program often ...If I want to debug a segment of code in my program, and the code will run in two threads simultaneously. When I set a breakpoint in the code, and run ... wglMakeCurrent deadlock - comp.graphics.api.opengl> any chance that 2 threads are trying to make the same Hdc (or context) > active ? Yes, but can this hang-up the program execution ? Doesn't it cause a crash ? Thread-safe Queue on Win32 - comp.programming.threadsHello. Is this implementation of thread-safe queue correct? Does it have any problem (correctness and performance)? Note: hEvent is auto release eve... Win32: Can a lockup ever happen on a Mutex ? - comp.programming ...If the thread proceeds as though the mutex object had not been abandoned, it is no ... The next program to come around should not be permitted to acquire the mutex as if ... sigwait() is not catching SIGUSR1 signal - comp.unix.programmer ...Hi, i have a problem with sigwait() in a multithreaded program. In this program some thread will be generating the signal SIGUSR1 a... socket lock in multithred programming - comp.unix.programmer ...Hi there, I am making a multithreaded process. it has a tcp/ip socket and two threads, one thread for sending message to socket, the other for recei... unix sockets and multithreading - comp.unix.programmerHi, I am using C on Solaris. I have a multithreaded program (pthreads). Is there any caveats in doing select on the same socket descriptor from two different threads ... Examples of Programs that use Threads - The Institute for Systems ...Examples of Programs that use Threads . To view these programs you will need a browser that supports Java 1.2, Java 1.3, or Java 2. That is, Netscape 4.x with ... Patagonia's Common Threads Initiative - Recycle your Patagonia GearCommon Threads Initiative: Take the Pledge Resources. Learn about our Recycling Program; Learn about E-Fibers 7/31/2012 2:10:14 AM
|