473,809 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy and expand an array

1 New Member
I am trying to copy values from an array in a parent class into an expanded array in a subclass. Here is my code so far:

public class AblistWithOccur ances extends Ablist

public AblistWithOccur ances ()
{
super(); //Copy Constructor
}

public int expandedList(St ring[]listItems,int []maxItems, int values)
{
int []expandedList = new int[(maxItems.lengt h + 100)];
}
for(int i=0;i<(maxItems .length + 100); i++)
{
expandedList[]=listItems.Abli st[];
return expandedList;
}

I am getting an illegal start of expression error message in regards to my "for" loop.
Dec 7 '06 #1
1 1773
horace1
1,510 Recognized Expert Top Contributor
remove the } indicated the compiler thinks it has come to the end of method expandedList()
Expand|Select|Wrap|Line Numbers
  1. public int expandedList(String[]listItems,int []maxItems, int values)
  2. {
  3. int []expandedList = new int[(maxItems.length + 100)];
  4. }    << remove this !!
  5. for(int i=0;i<(maxItems.length + 100); i++)
  6. {
  7. expandedList[]=listItems.Ablist[];
  8. return expandedList;
  9. }
  10.  
Dec 7 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
1762
by: sathyashrayan | last post by:
/* ** PLURALTX.C - How to print proper plurals ** public domain - original algorithm by Bob Stout */ #include <stdio.h> #define plural_text(n) &"s"
1
3927
by: jrs362 | last post by:
One more problem... I need to write a method(Which i'm calling "expand") that takes an int array as one of its parameters and returns a new int array that is 5 elements longer. The contents of the original array need to be copied into the last elements of the new array. The first 5 elements of the new array need to be set to the value of the second parameter to expand. So... int a = new int{1,2,3,4,5}; int a2 = expand(a,-1); should...
11
2889
by: Nospam | last post by:
I don't know what it is I am doing wrong, I am trying to get the menus to either expand or contract based on their previous states, i.e if already expanded if clicked again contract, and if contracted, expand, so far it doesn't work for the about and services link(but works for the expand all and contract all links), any help would be greatly appreciated: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
3
3339
by: aeo3 | last post by:
Hi All, Now, I am trying to build a project, I need to expand an array of pointer to classes. Moreover, this array includes some elements I want to delete them. So, I create another array, copy the elements which i want to keep and copy this array to the original one as follows This function to create two arrays it depends on the parameter x. void Econ::CreateFirms(int array,int x) { if(x==1) { FirmArray= new Firm*;
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7662
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.