
will this code work..? class A extends Thread { public void run() { for(int i=0;i<5;i++) system.out.println("i=" + i); } public static void main(string args[]) { A a = new A(); Thread t = new thread(a); t.start(); } } Is it possible to run above program with out attaching class object to thread..?

There are some compilation errors in your code. Here is your modified code:
class A extends Thread {
public void run() {
for(int i=0;i<5;i++)
System.out.println("i=" + i);
}
public static void main(String args[]) {
A a = new A();
Thread t = new Thread(a);
t.start();
}
}
Now the above code is working.
Your code will run as it is if you will not attach class object into Thread, but you have to modified some code like this:
class A extends Thread {
public void run() {
for(int i=0;i<5;i++)
System.out.println("i=" + i);
}
public static void main(String args[]) {
A a = new A();
a.start();
}
}