aspose file tools*
The moose likes Beginning Java and the fly likes I have a very simple problem...I don't know what it is though Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I have a very simple problem...I don Watch "I have a very simple problem...I don New topic
Author

I have a very simple problem...I don't know what it is though

Cam Ferguson
Greenhorn

Joined: Dec 09, 2003
Posts: 4
import java.util.Random;

class Array_Practice
{
public static void main ( String[] args )
{
}

// METHODS \\
public static void List1()
{
int i;
int List1[] = new List1[20]; <<<<
for (i = 0; i < 20; i++)
{
List1[i] = (int)(Math.random () * 100 + 1);
}
}
public static void List2()
{
int i;
int List2[] = new List2[20]; <<<<
for (i = 0; i < 20; i++)
{
List2[i] = 0;
}
}

public static void Multiply(int[] List1, int[] List2)
{
int i;
int x = 0;
int y = 0;
for (i = 0; i < 20; i++)
{
y = List1[i];
y = y * y;

List2[x] = y;
x++;
}
}

public static void replaceOdd(int[] List2)
{
int i;
for (i = 1; i < 20; i=i+2)
{
List2[i] = 0;
}
}
}
http://www.tvdsb.on.ca/Laurier/Ics3m1/practice/practicing_arrays.html
That is what I'm trying to do, I'm at IV right now. I get one of those "Cannot resolve symbol" errors where you see <<<<. Anyone know why?
Angel Dobbs-Sciortino
Ranch Hand

Joined: Sep 10, 2003
Posts: 101
When you use "new List1[20]" and "new List2[20]", the compiler is trying to find the classes List1 and List2. They do not exist. Change these to "new int[20]".
Angel
Amit More
Greenhorn

Joined: Oct 16, 2003
Posts: 24
Hi,
You can replace that lines with
int List1[] = new int[20];
int List2[] = new int[20];
And your file will get compiled.


Thanks,<br />Amit
Cam Ferguson
Greenhorn

Joined: Dec 09, 2003
Posts: 4
Thanks a lot. That's been driving me nuts, and I had no idea what was wrong with it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I have a very simple problem...I don't know what it is though