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


Please Help Members By Posting Answers For Below Questions

Difference between arraylist and vector.

580


Why put method is idempotent?

454


What is printwriter in java?

505


List the interfaces which extends collection interface?

525


How to find the given number is a prime number or not by getting input from the user

542






What is the lifetime and scope of a variable?

509


How many types of operators are there?

513


Can static methods be inherited?

529


What is serialversionuid?

553


Can we create our own daemon thread?

532


List some java keywords sun like c, c + + keywords?

583


Explain how hashmap works?

586


what is the purpose of the runtime class?

548


What is the difference between int and integer in java?

499


What is a jit compiler?

627