#I don't get the point

12 messages · Page 1 of 1 (latest)

tall monolith
#

Scanner in = new Scanner(System.in); System.out.print("Enter a text: "); String text = in.nextLine(); int index=0; int L = text.length(); while(index<L){ if(index==L-1){ System.out.print(text.charAt(index)); break; } System.out.print(text.charAt(index).concat(" ")); index++; }

My code has a problem and it's that I can not call concat() methode because 'text.charAt(index)' has primitive type char, I don't understand what's the problem, can someone please let me know?

modern slateBOT
#

This post has been reserved for your question.

Hey @tall monolith! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

compact mango
shadow walrus
#

you can just use + " " there really

modern slateBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

compact mango
rough moon
#

Generally speaking, primitives don't have methods

modern slateBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

tall monolith
#

Thanks Y'all

modern slateBOT
# tall monolith Thanks Y'all

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

modern slateBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.