Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Another question from marcus green mock exam

 
Veena Pointi
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The above code compiles & runs fine.Shouldn't it give compile time error?Coz run method of Thread class is not overriden in child class?
[ October 20, 2003: Message edited by: Veena Point ]
[ October 20, 2003: Message edited by: Thomas Paul ]
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Veena - can you please take some time and format your code with whitespace so that its actually readable? Its very difficult to read the code you post when it has no indentation.
Thanks
- Jess
 
Veena Pointi
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Jess,is it ok now?
Thanks
Veena
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Veena
You need to override the run() method of Runnable either directly or indirectly. If you don't, it's an error. The Thread's class run() method if not overriden would not result in any error. The thread would simply not do anything.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The run() method of Thread is not an abstract method so it does not have to be overridden.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic