aspose file tools*
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
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: 61766
    
  67

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: 19070
    
  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: 19070
    
  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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sams teach yourself java help