The Artima Developer Community
Sponsored Link

Java Answers Forum
help me plz

2 replies on 1 page. Most recent reply: Jul 25, 2003 3:30 AM by zenykx

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
smd

Posts: 1
Nickname: smd
Registered: Jul, 2003

help me plz Posted: Jul 23, 2003 11:07 AM
Reply to this message Reply
Advertisement
Write a method that recursively converts a string of numbers into an integer. For instance, convert("1234") would return the integer 1234.


Mr Plow

Posts: 18
Nickname: mrplow
Registered: Jun, 2003

Re: help me plz Posted: Jul 23, 2003 12:27 PM
Reply to this message Reply
In the Java API (downloadable here if you don't have it: http://java.sun.com/j2se/1.4.1/download.html#docs) browse to java.lang.Integer and learn how the parseInt(String s) method works. This should be helpful in creating your method.

Also make sure that you remember to provide code to handle the NumberFormatException(s) that java.lang.Integer.parseInt(String s) will throw if the String argument is not correctly formatted.

Hope this helps you get started on your project.

zenykx

Posts: 69
Nickname: zenykx
Registered: May, 2003

Re: help me plz Posted: Jul 25, 2003 3:30 AM
Reply to this message Reply
This seems to me to be a homework. Is it really so difficult to treat 1 character at a time and call recursively for the rest????

Flat View: This topic has 2 replies on 1 page
Topic: Running Jacor with Oracle Previous Topic   Next Topic Topic: JavaMail

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use