Results 1 to 2 of 2
Thread: taking something from an array.
- 05-10-2011, 01:26 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 19
- Rep Power
- 0
taking something from an array.
I have muliple classes and one of them is requesting that I take something from an array and print it out.
I think I have to do something likeJava Code:e.addPerson(p1);
public addPerson(){
return people;
}
but thats not requesting p1 specifically from the array. any ideas?
- 05-10-2011, 01:36 AM #2
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
You really haven't given much information. What is e, p1, people?
My guess is this: You can get a single element out of an array with the subscript operator([]).
Java Code:int[] x = new int[] {1, 2, 3, 4, 5, 6 }; System.out.println(x[0]); //prints 1
Similar Threads
-
Double not taking a point (eg 10.12)
By N00Bie in forum New To JavaReplies: 7Last Post: 02-11-2011, 11:56 PM -
taking number value without sign
By sara12345 in forum New To JavaReplies: 5Last Post: 06-01-2010, 10:03 AM -
Taking Java In School Need Help
By xEuPhOrIcSx in forum New To JavaReplies: 7Last Post: 02-04-2008, 08:02 AM -
Taking passwords on the console
By eva in forum Advanced JavaReplies: 2Last Post: 12-19-2007, 09:28 AM -
Taking input from console
By Java Tip in forum Java TipReplies: 0Last Post: 11-05-2007, 04:47 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks