File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Given: ... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


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

Given: ...

Folkert Meeuw
Greenhorn

Joined: Nov 25, 2009
Posts: 21

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
Dejan Miler
Ranch Hand

Joined: Nov 14, 2009
Posts: 56
You have typing mistake on line 12.

Dejan.


SCJP 1.6 in progress ....
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531


why does this give me compile error that Thread(Runnable) can not be found....
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Folkert please Use A Meaningful Subject Line when you start a topic.

Also you have to Quote Your Sources when you post a question.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
anyone???
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18136
    
  39

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


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8764
    
    5
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.


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
i am compiling from command....there is a compile error that Thread(Runnable) constructor.....cannot find symbol with location java.lang.Thread
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
Ankur kothari wrote:anyone???


I am not getting this error.


SCJP 6
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18136
    
  39

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

Joined: Nov 14, 2009
Posts: 56
Maybe he have another Thread class in that package
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
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

Joined: Sep 06, 2009
Posts: 531
cannot find symbol at line 12
symbol: constructor Thread(Runnable)
location: java.lang.Thread
Thread t=new Thread(r);
^
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
hey but the code works when i compile it from someother directory
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
i have cheecked everything...no thread.class in this directory
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18136
    
  39


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

Henry
Ankur kothari
Ranch Hand

Joined: Sep 06, 2009
Posts: 531
genius...i had Runnable.class..its compiling now
Kedar Sarmalkar
Greenhorn

Joined: May 25, 2007
Posts: 16
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Given: ...
 
Similar Threads
Threads Doubt
Question onThread
Q on Threads