Results 1 to 5 of 5
Thread: Array Problem?
- 06-19-2010, 10:25 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 9
- Rep Power
- 0
Array Problem?
Hi, I'm not exactly new to java but I do have problems every now and then, anyways I'm having a problem with this code:
(code is shortened to not include excess code you don't need to know about)
//code starts here
public class points
{
String[] points;
public points(Point3f[] pt)
{
for (int a = 0; a < getLength(pt); a++) {
points[a] = pt.toString(); }
}
}
//end of code
In this part of the code I'm converting Point3f[] into String[] (for java 3d stuff)
The problem is when this code compile it says:
'cannot find symbol - method getLength(javax.vecmathPoint3f[])'
method getLength() is a method from Class Array, pt is an array of point3f objects, I want to get the length of number of points in pt[], how do I rewrite the code to do that? :)
- 06-19-2010, 10:29 PM #2
Hey welcome to the forums! Here is how you get the number of elements in an array:
Next time, please put your code in [code] tags like I did above.Java Code:for (int a = 0; a < [B]pt.length[/B]; a++) { points[a] = pt.toString(); }"Experience is what you get when you don't get what you want" (Dan Stanford)
"Rise and rise again until lambs become lions" (Robin Hood)
- 06-19-2010, 10:58 PM #3
When posting error messages, please post all of the message, don't edit it.problem is when this code compile it says:
- 06-19-2010, 11:12 PM #4
Senior Member
- Join Date
- Feb 2010
- Location
- Ljubljana, Slovenia
- Posts
- 470
- Rep Power
- 4
If the getLength(Object array) method is in the Array class, then call it as such:
But, since the arrays have a .length field, wouldn't it be easier just to use that? Just like Lil_Aziz1 wrote.Java Code:Array.getLength(someArray);
Ever seen a dog chase its tail? Now that's an infinite loop.
- 06-19-2010, 11:25 PM #5
Member
- Join Date
- Jun 2010
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
array problem
By jabo in forum New To JavaReplies: 2Last Post: 03-31-2010, 09:54 AM -
Array problem
By c3jcarmy in forum New To JavaReplies: 11Last Post: 03-11-2010, 02:45 AM -
Array problem
By binarzt in forum New To JavaReplies: 5Last Post: 02-14-2010, 09:01 AM -
array problem
By oceansdepth in forum New To JavaReplies: 3Last Post: 04-05-2008, 02:25 AM -
array problem
By wats in forum New To JavaReplies: 1Last Post: 12-12-2007, 07:08 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks