Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ON THREADS

 
gopala krishna muvvala
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For starters, a class called Demo needs to be in a file called Demo.java, not gopal.java.
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you happen to have a class called Thread in your own project?
 
Campbell Ritchie
Sheriff
Pie
Posts: 48972
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please don't write ALL IN CAPITALS.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic