Solved

java container class assign an array

Posted on 2014-03-06
1
227 Views
Last Modified: 2014-03-06
I am using eclipse and I am new to it.  It gives me the error about creating an array in my container class CustomerHome.   What is wrong with the assignment?  What do I need to do if I want to create an array assignment based on Customers in the CustomerHome container class and add members to the customers array using CustomerHome?


public class Customers {
    public String getName() {
            return name;
      }
      public void setName(String name) {
            this.name = name;
      }
      public String getSsNumber() {
            return ssNumber;
      }
      public void setSsNumber(String ssNumber) {
            this.ssNumber = ssNumber;
      }
      public Customers(String name, String ssNumber) {
            super();
            this.name = name;
            this.ssNumber = ssNumber;
      }
      String name;
    String ssNumber;
   
    public class CustomerHome extends Customers {
          public CustomerHome(String name, String ssNumber) {
                  super(name, ssNumber);
                  // TODO Auto-generated constructor stub
            }

     Customers custarr[] = new custarr[10];
            
    }
    }
   
   
     
}
0
Comment
Question by:tangocoder
1 Comment
 
LVL 27

Accepted Solution

by:
dpearson earned 500 total points
ID: 39910445
Try:

 CustomerHome custarr[] = new CustomerHome[10];

or

 Customers custarr[] = new CustomerHome[10];

Doug
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question