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: Concatenation of numbers

  1. #1
    Junior Member
    Join Date
    Nov 2011
    Location
    South Africa
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Concatenation of numbers

    Hello,
    I have a problem of concatenating alphabet.
    I initially gave alphabets numeric value (e.g a=10, b=11) accordingly.
    Now i want to concatenate these vales. I have kept all these values
    in the database, what can i do to make use of the MySQL database to
    bring the values out and use them for concatenation in order to form
    a word.

    Concatenation of a word like "baby" (11+10+11+35) brings 11101135.
    How do i do it?

    Thank you very much


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,019
    Thanks
    52
    Thanked 2,276 Times in 2,247 Posts

    Default Re: Concatenation of numbers

    The compiler thinks 10+2 is a numeric expression and will add the two number together.
    If you want to create a String with "10" and "2" put an empty String: "" between them:
    10 + "" + 2

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: Concatenation of numbers

    This Forum is for Saying Hi, not for Asking Technical Questions (READ BEFORE POSTING)
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. [METHOD] How: Count how many prime numbers there is between two numbers!
    By Secret20 in forum Object Oriented Programming
    Replies: 4
    Last Post: October 18th, 2011, 02:30 PM
  2. [SOLVED] difference between String Concatenation and String -Buffer/Builder .append(<value>)
    By chronoz13 in forum Java Theory & Questions
    Replies: 5
    Last Post: September 3rd, 2011, 08:16 AM
  3. Adding Big Numbers
    By hoiberg in forum Java Theory & Questions
    Replies: 5
    Last Post: December 16th, 2010, 07:44 AM
  4. Day,Month,Year Concatenation Error
    By srinivasan_253642 in forum JDBC & Databases
    Replies: 1
    Last Post: January 22nd, 2010, 03:40 AM
  5. Random numbers
    By Pooja Deshpande in forum Java SE APIs
    Replies: 8
    Last Post: June 5th, 2009, 04:36 AM