return array from a class

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jan 2008
Posts: 15
Reputation: wolverine_ramir is an unknown quantity at this point 
Solved Threads: 0
wolverine_ramir wolverine_ramir is offline Offline
Newbie Poster

return array from a class

 
0
  #1
Feb 7th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 55
Reputation: WhYuLoOkIn is an unknown quantity at this point 
Solved Threads: 3
WhYuLoOkIn's Avatar
WhYuLoOkIn WhYuLoOkIn is offline Offline
Junior Poster in Training

Re: return array from a class

 
0
  #2
Feb 7th, 2008
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?
Doing what they say couldn't be done!!!!
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 15
Reputation: wolverine_ramir is an unknown quantity at this point 
Solved Threads: 0
wolverine_ramir wolverine_ramir is offline Offline
Newbie Poster

Re: return array from a class

 
-1
  #3
Feb 8th, 2008
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..
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 55
Reputation: WhYuLoOkIn is an unknown quantity at this point 
Solved Threads: 3
WhYuLoOkIn's Avatar
WhYuLoOkIn WhYuLoOkIn is offline Offline
Junior Poster in Training

Re: return array from a class

 
0
  #4
Feb 8th, 2008
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.


  1. public class myClass{
  2.  
  3. private int[] myArray = new int[10];
  4.  
  5. //return value of specified index
  6.  
  7. public int value(int indexNumber)
  8. {
  9. return myArray[indexNumber]
  10. }
  11.  
  12. //returns the array to the calling object
  13.  
  14. public int[] getArray()
  15. {
  16. return myArray;
  17. }
Doing what they say couldn't be done!!!!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC