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.

Results 1 to 3 of 3

Thread: Array question.

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Array question.

    Is it possible to convert a user inputted 4-digit number such as: '1234' into an array which holds the digits of that number in each index. So for this number it would convert to: [1, 2, 3, 4]. If this is possible, how is it done? Thanks in advance.


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Array question.

    What happened when you tried it? Did it work? Was there an error?
    We do not provide solutions to problems in code here, see the spoonfeeding policy on the subject.
    What we will do is help give suggestions when you get stuck. The suggestion here is to try it. Write a simple program to accept user input and try to do what you have described.

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Array question.

    Is the number in a String? Or in an int? Which one you work with will make a big difference in the code.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. array question
    By thirddigit in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 1st, 2012, 02:35 PM
  2. Array question
    By knightmetal in forum Collections and Generics
    Replies: 3
    Last Post: April 7th, 2012, 12:05 AM
  3. 2 array question
    By w.kit in forum Java Theory & Questions
    Replies: 1
    Last Post: January 16th, 2012, 07:56 AM
  4. 2D Array Question
    By gmorris1986 in forum Java Theory & Questions
    Replies: 2
    Last Post: June 18th, 2010, 11:40 AM
  5. A question about an array
    By faizana2006 in forum Collections and Generics
    Replies: 2
    Last Post: October 28th, 2009, 04:36 PM