Results 1 to 3 of 3
- 04-18-2008, 02:33 PM #1
Member
- Join Date
- Apr 2008
- Posts
- 5
- Rep Power
- 0
returning a value from an arraylist
How can you return a value from an arraylist that contains class objects and the class object contains both string and numeric variables?
need the numeric data to do further calculations with.
public class Student
{
private String name;
private double Stbalance;
// -------------------------------------------------------
// Create a new item with the given attributes.
// -------------------------------------------------------
public Student (String ssName, double sbalance)
{
name = sName;
Stbalance = sbalance;
}
}
ArrayList Theclass = new ArrayList();
pupil = new Student(studentname,studentbalance);
Theclass.add(pupil);
How can is use the get method to return the balance into another variable?
- 04-18-2008, 04:35 PM #2
Member
- Join Date
- Apr 2008
- Posts
- 5
- Rep Power
- 0
Ok... i figured out the answer by reading the post displayed below.
Java Project Trouble: Searching one ArrayList with another
got help on line 14 of the post which reads.
Integer firstTemp = (Integer) first.get(i);
- 04-18-2008, 05:30 PM #3
Member
- Join Date
- Apr 2008
- Posts
- 28
- Rep Power
- 0
Similar Threads
-
Java Project Trouble: Searching one ArrayList with another ArrayList
By BC2210 in forum New To JavaReplies: 2Last Post: 04-21-2008, 11:43 AM -
Need help returning data from database
By dyn03 in forum JDBCReplies: 0Last Post: 03-11-2008, 04:55 PM -
Returning a string (Partly Bold)
By TampaTechGuy in forum New To JavaReplies: 3Last Post: 02-03-2008, 09:54 AM -
JNI - passing and returning parameters by value
By java_to_c in forum New To JavaReplies: 0Last Post: 01-31-2008, 08:49 PM -
selectSingleNode not returning element...
By schu777 in forum XMLReplies: 4Last Post: 07-31-2007, 05:19 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks