Here’s my current situation:
import java.util.ArrayList;
import java.util.Scanner;
import com.sun.xml.internal.ws.api.pipe.NextAction;
import static java.lang.System.*;
public class NumberAnalyzer
{
private ArrayList<Number> list;
public NumberAnalyzer()
{
}
public NumberAnalyzer(String numbers)
{
String nums = numbers;
Scanner chopper = new Scanner(nums);
while(chopper.hasNext()){
int num = chopper.nextInt();
list.add(num);
}
list =
}
How would I go about converting a string of numbers, say 5 12 9 6 1 4 8 6, and add them to this ArrayList<Number> that I have? Eclipse is stating that
The method add(int, Number) in the type ArrayList is not applicable for the arguments (int).
EDIT
here are pastebin links to all the associated .java files:
http://pastebin.com/9KDXLwbL (NumberAnalyzer.java)
http://pastebin.com/BGRpbpyH (Number.java)
http://pastebin.com/EhmZ6kKH (runner class)
http://pastebin.com/BCzeZytg (NumberTester.java this one works well with Number.java, which was part one of the lab)
The problem is that you have another class
Number.Change your code this way:
In this way you are using you class
Number, and not the default one.