Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 2 of 2 FirstFirst 12
Results 26 to 27 of 27

Thread: Need to input algorithems with String values.

  1. #26
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 139 Times in 134 Posts

    Default Re: Need to input algorithems with String values.

    Quote Originally Posted by Leonardo1143 View Post
    Oh okay so using 10 for my example should fix it?
    Not quite. You don't want to pass a String literal into the method, but rather the String variable that holds the number String. The String held by the variable should have no spaces, no letters, no punctuation, nothing but a number, and you should place the result of this method call into an int variable. Why not give it another try and see what happens?

    As an aside, last I looked, your printf method call looked a bit off too.

  2. #27
    Member
    Join Date
    Dec 2012
    Posts
    31
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Default Re: Need to input algorithems with String values.

    Quote Originally Posted by curmudgeon View Post
    I think one problem is that you may be confusing Strings with variables. For instance if you have a variable named armor, it is not the same thing as the String "armor", and you can't use them interchangeably. For instance if you have

    String armor = "100";

    You can't use "armor" in a method as a substitute for the variable above.

    Re choice of 27, what example did you see it used in?

    Edit:
    Oh, I see. Yeah the Integer API does have an example of a 27 radix. This is very esoteric stuff, and something you'll likely never use. I suggestion that you don't use this example, but instead I'd use the Integer.parseInt method that takes a single String as a parameter, the one that uses the default base-10 radix.
    Okay, now i am bit confused. So I may just go the longer route and just individually label the parts I need for my algorithm to work (armor,combat level,etc). Thanks for trying though.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: May 16th, 2012, 06:15 PM
  2. Replies: 13
    Last Post: December 6th, 2011, 02:17 PM
  3. HELP! Cant pass my input values to the paint component
    By mindmaster in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 22nd, 2011, 05:39 PM
  4. JTable Updating String Values from User Input
    By aussiemcgr in forum AWT / Java Swing
    Replies: 5
    Last Post: August 3rd, 2010, 02:48 PM
  5. Values of Input
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: November 8th, 2009, 03:46 AM