CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014

    Test class returning null

    Hi, I'm a beginner programmer so apologies if this seems like a stupid question!

    I've tried to initialize my field numbers with an array of numbers in a constructor in one class and then call it in my test class and display it as a string but it keeps returning null....any help would be appreciated!

    This is my class that has the constructor

    public class NumerbList implements Number {
        ArrayList<Number> numbers = new ArrayList<Number>();
        //constructor taking array of type double as parameter
        public NumberList(Double[] numberlist){
            for(int i=0; i<numberlist.length; i++){
                NumberDouble numberd = new NumberDouble(numberlist[i]);
    and this is the class that tests it
    public class Test {
        public static void main(String[]args){
            Double[] d = {2.4, 3.6, 4.3, 5.1};
            NumberList numbers = new NumberList(d);

  2. #2
    Join Date
    Jun 1999
    Eastern Florida

    Re: Test class returning null

    Does the code you posted compile OK? If there are errors, copy the full text and paste it there.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.