File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Marshal

Joined: Mar 22, 2005
Posts: 42600
    
  65
For starters, a class called Demo needs to be in a file called Demo.java, not gopal.java.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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


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

Joined: Oct 13, 2005
Posts: 39803
    
  28
And please don't write ALL IN CAPITALS.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ON THREADS