IN java collections we have both interfaces and classes.
instead of using interfaces why we can't use classes only
like that why we can't use interfaces only. why we need two
things interface and class.
Answer Posted / reddy
The purpose of interface is to have abstract methods and
the class which implemnts the interface has to define the
methods in the interface.
The reason why java collections have both interfaces and
classes is interface will have common methods which will be
needed by one or many classes. The classes which wants to
behave like this interface will implement this interface
and define methods in the interface.
| Is This Answer Correct ? | 14 Yes | 4 No |
Post New Answer View All Answers
What is the SimpleTimeZone class?
What modifiers are allowed for methods in an interface?
For ease of programming you can consider the maze as a 2D array with colors represented by below integer and characters (in capital letters). • B - Black • W -White • G- Green • R- Red R B W B W W W W W W B W B B W W W W W W W B W B W W W B W W W W B B W W W B W W W B W W B B B B W B W B W W B W W W B W W W B B B W W B W W W B W W B W B W W W B W B W W W W B B W W W W B W W W W W G Shortest Route Problem: • Solution that finds the shortest Route between Red and Green White will have 1 Weight. Red and Green carry no weights. Shortest path is the path with less weight when you add up the weights in the path.
What are the advantages of autoboxing?
Define nashorn in java8.
What differences exist between iterator and listiterator?
What restrictions are placed on method overriding in java programming?
What are exceptions
In how many ways we can create threads in java?
If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?
How to instantiate static nested classes in java?
Java is pass by value or pass by reference? Explain
Similarity and difference between static block and static method ?
What is binary tree in java?
how we can make a read-only class in java?