Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





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.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-18-2008, 01:10 PM
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
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)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-18-2008, 01:35 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 01:45 PM
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
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
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-18-2008, 01:48 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-18-2008, 02:32 PM
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
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
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-18-2008, 03:29 PM
Member
 
Join Date: Apr 2008
Posts: 30
raj reddy can only hope to improve
Hi Eranga


Did u got the code


if any queries reply me
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-21-2008, 04:26 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by raj reddy View Post
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,

Code:
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.
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 04-21-2008, 04:28 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,037
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by raj reddy View Post
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Idref Element and its advantages Java Tip Java Tips 0 03-30-2008 11:04 AM
Max element in an Array mew New To Java 5 12-03-2007 06:26 PM
How to use Idref Element and its advantages JavaBean Java Tips 0 09-26-2007 09:37 PM
a no such element exception headlice1 New To Java 1 08-07-2007 06:36 PM


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