karthik manick wrote:I read this in a website "Constructor arguments cannot be specified on an interface". Is it so? Please explain why?
Serlets are also interfaces...but i have seen constructors for servlets...contrdicting?
List is an interface, and defines a contract (what methods are available in classes that implement it).
ArrayList is a class, it can be instantiated. It has constructors.
Methods can hide creating instances, and return the interface, just like above. That way, they can hide their internal behaviour, which helps
you write code that's easier to maintain: you don't have to worry about the type that's used internally, whether it's an ArrayList, a LinkedList, a CopyOnWriteArrayList or SomeSpecialList.
Same with your servlets.