Your code is very difficult to read without code tags; since you are new I have edited your post, and you can see how much better it looks.
Please always tell us the details of what the problem is; you don't actually say what it going wrong.
I can see at least two problems.
Your class x should not extend a. It should only implement ActionListener.
You are adding a new b to your button. You would probably have to add something which is an ActionListener, eg an x.
Your class names are poorly-chosen. Nobody knows what class a is for, and class names should start with capital letters.
Why are you using AWT components (Frame) rather than Swing (JFrame)?
Joined: Oct 13, 2005
More that I can see: You will have no end of problems if you use the == operator to test Strings for equality.
I have my own opinion about ActionCommands, and don't like them. Have a look at this old thread, and the thread it sprang from, which you will find quoted in the first posting. You find your action command is quite unnecessary in this instance.
Joined: Sep 15, 2010
Later On solved the problem.
I just wanted to handle an event in a separate handler class as most of coder handle them either through inner classes.
I will take care now onwards that i could write explicitely what all constructs are doing.