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

If a variable is declared as private, where may the variable be accessed?

554


Which arithmetic operations can result in the throwing of an arithmeticexception?

601


How do you write a good declaration?

498


Why do we use return statement?

545


If an application has multiple classes in it, is it okay to have a main method in more than one class?

541






How do you compare two strings lexicographically?

545


What is %02d?

580


explain the difference between jdk and jvm?

564


Is .net better than java?

559


What is the final keyword in java?

558


What is %d in printf?

534


Is boolean a data type in java?

523


What is percentage in java?

577


What is the difference between public, private, protected, and friend access?

575


What is the maximum size of a string in java?

553