Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sams teach yourself java help

 
Tyler Heez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the code. Be sure to UseCodeTags.
 
Tyler Heez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21000
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tyler Heez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21000
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was it thank you very much. I had a file named Thread.java in the same directory. Your the best thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic