Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2010
    Posts
    4

    Unanswered: Separates variable by spaces

    Hi!

    I'm new to Java, so I don't have to much experience with Java. This is a basic question, I want to know how separate a variable by spaces. For example:
    you have 1234, so the program should print 1 2 3 4. I'm not very good with english, so I tried to ask as well as I could. If you know how, please tech me how, Thnks is advance.

  2. #2
    Join Date
    Aug 2010
    Location
    Sydney
    Posts
    15

    Java Developer here

    Hi bolanta48,

    I'm a Java Developer and I think for something like that you need to be clear with what your outcomes/test cases are.

    For example, will you ALWAYS have a single digit number spat out from the string?
    ie 12345 will give 1 2 3 4 5
    not 12 3 45

    And will your inputs ALWAYS be numbers?

    If you're always going to have single digit outputs, I'd suggest just converting the number into a String or char[] and then using a char walker.

    Anyway... my 2cents

  3. #3
    Join Date
    Aug 2010
    Posts
    1
    I agree bolanta48. and since this is my first tine on JAva. I suggest that you go to other threads as well. and thank you to your suggestion, I really appreciate it.

  4. #4
    Join Date
    Feb 2010
    Posts
    4
    Quote Originally Posted by Al_RelEZ_Al View Post
    Hi bolanta48,

    I'm a Java Developer and I think for something like that you need to be clear with what your outcomes/test cases are.

    For example, will you ALWAYS have a single digit number spat out from the string?
    ie 12345 will give 1 2 3 4 5
    not 12 3 45

    And will your inputs ALWAYS be numbers?

    If you're always going to have single digit outputs, I'd suggest just converting the number into a String or char[] and then using a char walker.

    Anyway... my 2cents
    Thanks Al_RelEZ_Al,

    The program should output any digits; 1234, 2343, 4533. The important is how to separate by spaces.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •