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

Answers were Sorted based on User's Feedback



Hi Every One I Have Small Doubt Please answer This???????????????????????????? I Want to use Ab..

Answer / 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

Hi Every One I Have Small Doubt Please answer This???????????????????????????? I Want to use Ab..

Answer / prashanth.vuthuru

AnyOne can Please Provide The
Solution????????????????????????? Plzzzzzzz

Is This Answer Correct ?    0 Yes 0 No

Hi Every One I Have Small Doubt Please answer This???????????????????????????? I Want to use Ab..

Answer / raghav

Bcoz ur class ( DemoOne ) is concrete class so u r forced to provide body to that methods that r unimplemented in java.util.AbstractList

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How HashMap implemented in java? how it internally works when values are added or searched from hashMap?What is the difference betweenthe implementation of hashmap and Linked Hashmap?

3 Answers   IBM,


What is the USE of Null interfaces ??...if thers nothing inside these interfaces how are they used and WHy are they used ???? No 1 has given a proper description yet

1 Answers  


Is 9 a prime number?

0 Answers  


Explain what are final variable in java?

0 Answers  


Is it possible to cast an int value into a byte variable? What would happen if the value of int is larger than byte?

0 Answers  






What is downcasting?

0 Answers  


How do you insert a line break?

0 Answers  


How to eliminate duplicates from an array?

6 Answers   ABC, AdMod, Adobe, College School Exams Tests, Patni, Wipro,


What are static blocks in java ?

0 Answers  


What does microservices mean?

0 Answers  


What is function overriding and overloading in java?

0 Answers  


What is private protected in java?

0 Answers  


Categories