aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Marcus Exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Marcus Exam" Watch "Marcus Exam" New topic
Author

Marcus Exam

Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
Is this answer explanation is correct in marcus exam 2? He didn't mention why b.run() doesn't cause the error? I guess since the Thread method has run() method which will be called when there is no explicit run() in your class. Is this correct?
public class Bground extends Thread{
public static void main(String argv[]){
Bground b = new Bground();
b.run();
}
public void start(){
for (int i = 0; i <10; i++){
System.out.println("Value of i = " + i);
}
}
}


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Originally posted by Thiru Thangavelu:
Is this correct?

Yes. The class Thread implements the Runnable interface so it is required to have a run method. Of course, the run method, as defined in Thread, does nothing. However, as Thread has a run method, it is legal to invoke it.
Corey


SCJP Tipline, etc.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Marcus Exam