Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writting a method inside the thread's run method

Status
Not open for further replies.

jeevan

Programmer
Apr 11, 2001
9
IN
hi all,
when i adding a new method inside the thread's run method,compiler shows statement expected error. what will be the problem . if any one have the solution please reply

 
An example would be nice or even the exact error message.

[sig]<p>Troy Williams B.Eng.<br><a href=mailto:fenris@hotmail.com>fenris@hotmail.com</a><br><a href= > </a><br> [/sig]
 
If i read yor question correctely, (you should put code) you are trying to call a method inside of run, or are you trying to put a method inside of run... You should have no problem calling another class or method inside of run, putting a new method inside of run, may run into some problems though.....

could you please clarify B-)

later
[sig]<p>ackka<br><a href=mailto:tmoses@iname.com>tmoses@iname.com</a><br><a href= my site</a><br>"Do No Harm, Leave No Tracks"<br>
ICMP Summer 2000, 2600 Article<br>
<br>
[/sig]
 
the qustion is can i declare a new method inside the threads run method.for eg:

Thread t = new Thread(this);

public void run(){
void anothermethod(){
//statemets;
}
}

when i compiling,compiler shows the error statement&quot;}&quot; expected.What could be wrong.

pls reply
 
Java does not like c/c++ or pascal in this case. You can not do this. Put the another method outside the run().

Bye, Otto.
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top