This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes ON THREADS Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ON THREADS" Watch "ON THREADS" New topic
Author

ON THREADS

gopala krishna muvvala
Greenhorn

Joined: Aug 26, 2008
Posts: 3
I am geting compile time error on this below code whats wrong in this code ? HELP ME.

class Demo
{
public static void main(String[] ar)
{
Thread t=Thread.currentThread();
System.out.print(t);
System.out.println(t.getName());
}

}

I am geting this error
E:\java>javac Demo.java
Demo.java:7: cannot access Thread
bad class file: .\Thread.java
file does not contain class Thread
Please remove or make sure it appears in the correct subdirectory of the classpath.
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
oops
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42956
    
  73
For starters, a class called Demo needs to be in a file called Demo.java, not gopal.java.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20049
    
  30

Do you happen to have a class called Thread in your own project?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 43381
    
  32
And please don't write ALL IN CAPITALS.
 
 
subject: ON THREADS
 
jQuery in Action, 3rd edition