This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Need Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need Help" Watch "Need Help" New topic

Need Help

Will Zelan
Ranch Hand

Joined: Apr 15, 2012
Posts: 56

Question-Write a java program to compute the first 25 prime numbers. Also compute the first 50 Fibonacci numbers given by fn=fn-1 +fn-2 with f1 =f2=1.create two thread to compute each one of them .set the priority of thread that compute Fibonacci number to 8 and the other to 5.After calculating 50 Fibonacci number, make that thread to sleep and take up prime number computation. After computing the 25 prime numbers continue the Fibonacci number computing.
Help For writing code
Mansukhdeep Thind
Ranch Hand

Joined: Jul 27, 2010
Posts: 1157

Welcome Will.

Wiser men than me told me that it is imperative that you first work out the logic on a piece of paper using a pencil. Lets start with writing the logic for calculating first 25 prime numbers, shall we? I assume you do know what a prime number is, a number which is divisible by only 1 and the number itself. What you have to do is just try out writing the code for it. Try yourself to write it. What exactly is it that you need assistance with? You do know the basics of the Java language . Am I right?

~ Mansukh
I agree. Here's the link:
subject: Need Help