Hi Every One I Have Small Doubt Please answer
This????????????????????????????
I Want to use AbstractList class
methods(java.util.AbstractList)
My Program is
import java.util.*;
class DemoOne extends AbstractList
{
public static void main(String[] args)
{
AbstractList a=new DemoOne();//This One is Correct??
DemoOne a1=new DemoOne();//This One is Correct?? Both Are
Not Working
System.out.println("Hello World!"+a);
System.out.println("Hello World!"+a1);
}
}
Error IS:
DemoOne.java:2: DemoOne is not abstract and does not
override abstract method get(int) in java.util.AbstractList
class DemoOne extends AbstractList
AnyOne can Please Provide The
Solution????????????????????????? Plzzzzzzz
Answer Posted / tirumurugan
please Try Following code
import java.util.*;
class DemoOne extends AbstractList {
public static void main(String[] args)
{ AbstractList a=new DemoOne();
//This One is Correct??
DemoOne a1=new DemoOne();
System.out.println("Hello World!"+a);
System.out.println("Hello World!"+a1);
}
@Override
public Object get(int index) {
// TODO Auto-generated method stub
return null;
}
@Override
public int size() {
// TODO Auto-generated method stub
return 0;
}
}
It will work without error.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How to calculate the length of a singly linked list in java?
What environment variables do I need to set on my machine in order to be able to run java programs?
How do you sort a string in alphabetical order in java?
What are assembly attributes?
What is lexicographically smallest string?
What are new features introduced with java 8 ?
What is the difference between JDBC 1.0 and JDBC 2.0?
What is unmodifiable collection in java?
Explain implementation and how is it different from conversion?
What is the difference between a choice and a list?
Explain reverse a linked list recursive java solution?
What are sets in java?
Can I import same package/class twice?
Do you know why doesn't the java library use a randomized version of quicksort?
What is the difference between a switch statement and an if statement?