You have a conflict there with the name Menu
. You need to import the proper classes.Use
java.awt.Menu m1=new java.awt.Menu();
if you want to go with your class name as Menu
or else change your class name to some other name and import a Menu class.
solved i am getting an error in adding a menu item to a menu [closed]