|
|
|
|
Welcome to the Java Forums.
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:
- have access to post topics
- communicate privately with other members (PM)
- not see advertisements between posts
- have the possibility to earn one of our surprises if you are an active member
- access many other special features that will be introduced later.
Registration is fast, simple and absolutely free so please, join our community today!
If you have any problems with the registration process or your account login, please contact us.
|
|

04-18-2008, 01:10 PM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 30
|
|
|
How to fetch an arralist element (i need the code)
WE HAVE TO CALL THE "SEL1" element IN THE PUBLI STATIC VOID MAIN METHOD.
[ "SEL1" element is located in an array in the public List fetchTicketkey1() method ie
al.add(rs.getInt("sel1")]
public class Keno {
public List fetchTicketkey1() {
List al = new ArrayList();
try {
pstmt=con.prepareStatement("select * from draw );
rs=pstmt.executeQuery();
while(rs.next()) {
al.add(rs.getInt("sel1"));
al.add(rs.getInt("sel2"));
}
} catch(Exception e) {
} return al;
}
public static void main(String[] args) {
Keno ken = new Keno();
List al = (List) ken.fetchTicketkey1();
}}(i need the code)
|
|

04-18-2008, 01:35 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
|
|
|
What you are looking here?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-18-2008, 01:45 PM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 30
|
|
|
hi Eranga
Thks for u r reply
how can we call the sel1 variable
/* ie located in al.add(rs.getInt("sel1"))*/
in the public static void main method
system.out.println( " the value of sel1 is " + al.sel1) //this is showing error
i need the correct code
|
|

04-18-2008, 01:48 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
|
|
|
You want to get the element name sel1 which is in the al List, right?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-18-2008, 02:32 PM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 30
|
|
|
yes, i need that element in the
public static void main method
for example like this ::: system.out.println( " the value of sel1 is " + al.sel1) //this is showing error
|
|

04-18-2008, 03:29 PM
|
|
Member
|
|
Join Date: Apr 2008
Posts: 30
|
|
|
Hi Eranga
Did u got the code
if any queries reply me
|
|

04-21-2008, 04:26 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
|
|
Originally Posted by raj reddy
yes, i need that element in the
public static void main method
for example like this ::: system.out.println( " the value of sel1 is " + al.sel1) //this is showing error
Yes, it's wrong. Get the element of the al list, you have to refer the index of that. Say sel1 is in the 0[sup]th[/sup] place in the list. To get the value,
system.out.println( " the value of sel1 is " + al.get(0));
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|

04-21-2008, 04:28 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
|
|
Originally Posted by raj reddy
Hi Eranga
Did u got the code
if any queries reply me
Did you read any document relating to this. And also are you working on a Java IDE? If so, you comes with compile errors. Did you read them carefully?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. (Close on September 4, 2008)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
All times are GMT +3. The time now is 10:53 AM.
|
|
VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org