Actually the value in Vector is object. So you can do like this int totalNum = 100; int tempTotal = Integer.parseInt(pollVotecount.elementAt(i).toString()); or you can do like this. int tempTotal =((Integer)pollVotecount.elementAt(i)).integerValue();
int tempNum = tempTotal / totalVotes); Either way it will work Thanx Yogaraj -----Original Message----- From: Lai, Kenny [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 11:33 AM To: [EMAIL PROTECTED] Subject: vector cast to int i'm trying to do an explicit cast from vector object to int.. if you look at the below stripped out code, where tempTotal is defined, that (int) conversion doesnt work.. ultimately i'm trying to perform a division computation w/ totalVotes. anyone have a solution??? ---- java.sql.ResultSet regularPoll = null; try { regularPoll = db.execSQL(" select votecount from sometable where id=someid"); } catch (SQLException e) { System.err.println(e.toString()); } Vector pollVotecount = new Vector(); while(regularPoll.next()) { pollVotecount.addElement(regularPoll.getString("votecount")); } int totalNum = 100; int tempTotal = (int) pollVotecount.elementAt(i); int tempNum = tempTotal / totalVotes); =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com "THIS E-MAIL MESSAGE ALONG WITH ANY ATTACHMENTS IS INTENDED ONLY FOR THE ADDRESSEE and may contain confidential and privileged information. If the reader of this message is not the intended recipient, you are notified that any dissemination, distribution or copy of this communication is strictly Prohibited. If you have received this message by error, please notify us immediately, return the original mail to the sender and delete the message from your system." =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com
