0

is it possible that i could create an array from a class and return the value of that array? and how? how can i access that array

2
Contributors
3
Replies
6
Views
9 Years
Discussion Span
Last Post by WhYuLoOkIn
0

Yes its possible to create an array in a class and multiple ways to return it depending on what your trying to do, So what are you trying to do?

-1

for example, i am accessing values from a database.. i want to store them in an array.. but my problem is i can't access my array on my jsp page..
it returns null.. my program is quite long so i hope you could help me with a simple program so that i can pattern your program with mine. thanks really..

0

Here is some simple code that will show you how to access private variables in a class, If this is not what your looking for let me know.

public class myClass{

      private int[]  myArray = new int[10];

     //return value of specified index      

      public int value(int indexNumber)
     {
         return myArray[indexNumber]
     }

     //returns the array to the calling object

     public int[] getArray()
    {
         return myArray;
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.