Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:18:53+00:00 2026-06-04T11:18:53+00:00

How do i add all charAcro[] to create a string? example charAcro[0] = a,

  • 0

How do i add all charAcro[] to create a string? example
charAcro[0] = a, charAcro[1] = b, charAcro[2] = c, which makes the string abc

 while(resultSet.next()){
                    String Name = rs.getString(1);
                    String Acro=Name;
                    String delimiterAcro = " ";
                    String[] temp =null;
                    char[] charAcro = null;
                    temp = Name.split(delimiterAcro);
                    for(int i = 0;i<temp.length;++i){
                    charAcro[i] = temp[i].charAt(0);
                    //SOME CODE HERE?
                    }

      }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:18:55+00:00Added an answer on June 4, 2026 at 11:18 am

    There is a String constructor available that takes a char array,

    char data[] = {'a', 'b', 'c'};
    String str = new String(data);
    

    While I’m at it, look into Java Naming Conventions. Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Whereas variables are in mixed case with a lowercase first letter. Internal words start with capital letters.

    For example in your code snippet you have,

    String Name = rs.getString(1);
    

    which is bad, if not wrong.

    Moreover, you are likely to have a NullPointerException at line,

    charAcro[i] = temp[i].charAt(0);
    

    as you didn’t initialise the array. Below is the code which should work for you.

    String name = rs.getString(1);
    String[] temp = name.split(" ");
    char[] charAcro = new char[temp.length];
    for (int i = 0; i < temp.length; ++i) {
        charAcro[i] = temp[i].charAt(0);
    }
    System.out.println(new String(charAcro));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is their a way to add all files that arent present with svn example.
I'm trying to create an array in MIPS Assembly, and then add all the
I have Two spinner(Subject and Chapter),I crate two table(Chapter,subject). I add all subject name
I have two lists: List<string> _list1; List<string> _list2; I need add all _list2 different
Using this I tried to create a custom ListAdapter that would simply add all
I'm trying to add all the numbers in a string in Objective-C and I
I have an AppDelegate which has 3 views. I add all three [window addSubview:gameViewController.view];
I have an array e.g. string[] ccsplit. I want to add all of these
how can i add all swf files from dir to player in vb by
How can I add all of my array values together in PHP? Is there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.