• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Given: ...  RSS feed

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What is the result ?
(A) Cat
(B) Dog
(C) Compilation fails
(D) The code runs with no output
(E) An exception is thrown at runtime
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have typing mistake on line 12.

Dejan.

 
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


why does this give me compile error that Thread(Runnable) can not be found....
 
Sheriff
Posts: 9613
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folkert please Use A Meaningful Subject Line when you start a topic.

Also you have to Quote Your Sources when you post a question.
 
Ankur kothari
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone???
 
author
Sheriff
Posts: 23603
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ankur kothari wrote:why does this give me compile error that Thread(Runnable) can not be found....



Compiles fine for me -- eclipse using Java 5.

Henry
 
author
Sheriff
Posts: 8981
19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

Please, please, please indent your code

you should do it for yourself, so that you'll have an easier time debugging stuff.
You should do it so that when you show your code to other people they won't be tempted to poke your eyes out.
 
Ankur kothari
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am compiling from command....there is a compile error that Thread(Runnable) constructor.....cannot find symbol with location java.lang.Thread
 
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ankur kothari wrote:anyone???



I am not getting this error.
 
Henry Wong
author
Sheriff
Posts: 23603
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ankur kothari wrote:i am compiling from command....there is a compile error that Thread(Runnable) constructor.....cannot find symbol with location java.lang.Thread




Can you show us the full error listing?

Henry
 
Dejan Miler
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe he have another Thread class in that package
 
Punit Singh
Ranch Hand
Posts: 952
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ankur kothari wrote:i am compiling from command....there is a compile error that Thread(Runnable) constructor.....cannot find symbol with location java.lang.Thread



I am not getting error from the command line also.
 
Ankur kothari
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
cannot find symbol at line 12
symbol: constructor Thread(Runnable)
location: java.lang.Thread
Thread t=new Thread(r);
^
 
Ankur kothari
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey but the code works when i compile it from someother directory
 
Ankur kothari
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have cheecked everything...no thread.class in this directory
 
Henry Wong
author
Sheriff
Posts: 23603
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Did you happen to create your own Runnable class or interface?

Henry
 
Ankur kothari
Ranch Hand
Posts: 531
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
genius...i had Runnable.class..its compiling now
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Folkert Meeuw wrote:
What is the result ?
(A) Cat
(B) Dog
(C) Compilation fails
(D) The code runs with no output
(E) An exception is thrown at runtime



C - If there is mistake on line 12
D - If you fix line 12 and If you do not call t.start();
B - If you fix line 12 and If t.start() is called, because the anonymous class created overrides the run method.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!