aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes compile time errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "compile time errors" Watch "compile time errors" New topic
Author

compile time errors

Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127

Hi All,
can anybody provide the explanation as why the above program is giving compile time errors

thanks
venkat

([B] tags added and formatted[/B])
[ May 12, 2005: Message edited by: Barry Gaunt ]
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
You need a run method with no arguments if you implement Runnable
Kumar J
Ranch Hand

Joined: Feb 13, 2005
Posts: 35
Originally posted by Venkat Ramsimha:
public class Fooaw implements Runnable
{
void run (Thread t)
{
System.out.println("Running");
}
public static void main (String[] args)
{
new thread (new Fooaw()).start();
}
}
Hi All,
can anybody provide the explanation as why the above program is giving compile time errors

thanks
venkat



where have you declared thread class ?
and where have u declared run() ?


[ May 12, 2005: Message edited by: Mr Kumar J ]
[ May 12, 2005: Message edited by: Mr Kumar J ]

With Regards,<br />Kumar J
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
Thread is part of java.lang

the run method is defined in the Runnable interface; also part of java.lang
Kumar J
Ranch Hand

Joined: Feb 13, 2005
Posts: 35
Originally posted by Timmy Marks:
Thread is part of java.lang

the run method is defined in the Runnable interface; also part of java.lang


Hi timmy, he has declared thread whose first letter is small t which is not Thread you are talking.and run() as you said earlier he has not defined.

Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
Ok, I didn't look closely enouth to notice that a thread was instantiated instead of a Thread. Either way, it won't compile because the Runnable interface is not implemented.
Venkat Ramsimha
Ranch Hand

Joined: Dec 28, 2004
Posts: 127
Thats fine but anybody can correct the compile time errors which iam facing and provide the explanation for that?

thanks in advance,
venkat
Timmy Marks
Ranch Hand

Joined: Dec 01, 2003
Posts: 226
We have already told you the two main problems with the code.

With the two corrections mentioned:
1. Runnable interface requires a method
public void run()

2. Thread is a class, thread is a typo

the code will work
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compile time errors