Solved

java container class assign an array

Posted on 2014-03-06
1
224 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 26

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now