wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Sams teach yourself java help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Sams teach yourself java help" Watch "Sams teach yourself java help" New topic
Author

Sams teach yourself java help

Tyler Heez
Greenhorn

Joined: Sep 01, 2012
Posts: 4
Im in hour 19 of sams java book and we are talking about threaded programs. I have copied over his programs or even copy and pasted them and there is just something run with the threaded part of them.

indPrimes.java:36: error: constructor Thread in class Thread cannot be applied to given types;
go = new Thread(this);
^
required: no arguments
found: FindPrimes
reason: actual and formal argument lists differ in length
./Thread.java:31: error: constructor Thread in class Thread cannot be applied to given types;
t = new Thread( this );
^
required: no arguments
found: Thread
reason: actual and formal argument lists differ in length
./Thread.java:80: error: cannot find symbol
t.sleep( 1000 ); // interval given in milliseconds
^
symbol: method sleep(int)
location: variable t of type Thread
3 errors

Those are the errors I get. Any idea why I am getting these?

Here is the link to the code if your interested in checking it out. Any help is appreciated I really cant figure this out and would like to finish up these last few chapters.Thanks a bunch
http://workbench.cadenhead.org/book/java-7-24-hours/source/chapter19/PrimeFinder.java
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60788
    
  65

Please post the code. Be sure to UseCodeTags.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tyler Heez
Greenhorn

Joined: Sep 01, 2012
Posts: 4
Name change sent posted the code in the URL link at the bottom. Its all typed up for the book already. Sorry about tbreaking the "rule" just been frustrated with threads
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18542
    
  40

Java Newb wrote:
./Thread.java:31: error: constructor Thread in class Thread cannot be applied to given types;


Did you happen to have written your own Thread class?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Tyler Heez
Greenhorn

Joined: Sep 01, 2012
Posts: 4
No i didnt write my own thread class. I only did what the book told me and what is written in the url code above.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18542
    
  40

Java Newb wrote:No i didnt write my own thread class. I only did what the book told me and what is written in the url code above.


Can you check again? Do you happen to have a Thread.java (or Thread.class) file in the same directory?

Henry
Tyler Heez
Greenhorn

Joined: Sep 01, 2012
Posts: 4
That was it thank you very much. I had a file named Thread.java in the same directory. Your the best thank you.
 
 
subject: Sams teach yourself java help
 
Similar Threads
Abstract and array
Can you please clarify my doubt ?
Constructor Issues
Bad constructor?
Add ActionListener to open new JFrame + error