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 9187315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:44:23+00:00 2026-06-17T19:44:23+00:00

I tried to make a program that separates characters. The question is: Create a

  • 0

I tried to make a program that separates characters.
The question is:

“Create a char array and use an array initializer to initialize the array with the characters in the string ‘Hi there’. Display the contents of the array using a for-statement. Separate each character in the array with a space”.


The program I made:

String ini = "Hi there";
char[] array = new char[ini.length()];

for(int count=0;count<array.length;count++) {
   System.out.print(" "+array[count]);
}

What should I do to fix this problem?

  • 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-17T19:44:25+00:00Added an answer on June 17, 2026 at 7:44 pm

    Here’s how you convert a String to a char array:

    String str = "someString"; 
    char[] charArray = str.toCharArray();
    

    I’d recommend that you use an IDE when programming, to easily see which methods a class contains (in this case you’d be able to find toCharArray()) and compile errors like the one you have above. You should also familiarize yourself with the documentation, which in this case would be this String documentation.

    Also, always post which compile errors you’re getting. In this case it was easy to spot, but when it isn’t you won’t be able to get any answers if you don’t include it in the post.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a program that: reads a list of Chinese characters from
I tried to make a program that has a correct Divide function. My code
I tried to make a short program that works out the famous Drake equation.
I tried to make a program that reads ELEM structures from keyboard and writes
I tried to make a program that tells you how many words, lines and
I tried to make a program that writes struct elements to binary file and
So I tried the following program to make an async server, when its sync
I am needing to make a program that can do syntax highlighting and the
I am working on a problem that says to make a program that gets
I'm trying to make a simple program that goes to a page and clicks

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.