?
Solved

java container class assign an array

Posted on 2014-03-06
1
Medium Priority
?
230 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 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