I am instantiating List,Stack,Bag classes in my programe,but its giving error 'cannot resolve symbol' on these lines.I think i need to import any package or implement any interface,so if any of these is required please guide!
Well, there are no "Bag" classes in the standard Java APIs, and List is an interface, which you can't instantiate. Stack is a concrete class, though. It (along with all the other Collections classes) is in the java.util package, so "import java.util.Stack;" would let you create one in your program. Read the javadocs for the classes in that package -- there are lots of interesting ones!