Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

java container class assign an array

Posted on 2014-03-06
1
Medium Priority
?
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 28

Accepted Solution

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

 CustomerHome custarr[] = new CustomerHome[10];

or

 Customers custarr[] = new CustomerHome[10];

Doug
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

610 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