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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:17:45+00:00 2026-05-30T18:17:45+00:00

I want to read a String character by character which is already in an

  • 0

I want to read a String character by character which is already in an array.

String ss = "makassar";
String my_array[] = ss.split("");
for (int i = 1; i < ss.length()+1; i++) {
  if (my_array[i]=="m") {
     Toast toast = Toast.makeText(this, "Array is M", Toast.LENGTH_SHORT);
     toast.setGravity(Gravity.CENTER, 0, 0);
     toast.show();
     // Toast not show
  }
}

Toast is not getting displayed. Why? Any idea?

  • 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-05-30T18:17:46+00:00Added an answer on May 30, 2026 at 6:17 pm

    You should use equals() and not operator== to compare strings.

    operator== checks for identity of objects [if the left and the right are the same object], while equals() checks equality [if the 2 strings equal each other].

    Change this:

    if (my_array[i]=="m")
    

    to this:

    if ("m".equals(my_array[i]))
    

    Also, note that my_array[1] is the second element, and not the first, so you might want to start from i = 0 and not i = 1

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

Sidebar

Related Questions

I have a very long String and I want to read character by character
I want to make a program that will read some number in string format
I have a string that I want to have PHP read as a piece
I want to be able to split csv strings in Oracle 9i I've read
I want to read the registry to find the current PowerPoint version. However this
here i want to run this program and take one character pointer like char
I have a code in which the character array is populated by integers (converted
I have text file with string which code page is 1250. I want to
What I want to do is read a line from text file which contains
I want to read from the text file which is placed in res/raw/text i

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.