Solved

java container class assign an array

Posted on 2014-03-06
1
228 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

Title # Comments Views Activity
Way to decrease size of apk file 9 109
hibernate jars 4 59
Glassfish admin console not working 1 59
How to log java errors in tomcat 8 24
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

733 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