Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Okay, so, I am working on porting an IM client over from autoit to java, and I'm still rather new to java.
What I am attempting to do is create a 2d array where I can store every user's conversation history in the array next to their name.
Then what I want to do, is, on demand, write this chat history into an edit control, by providing the user's username, thus showing the chat history with that user on screen when asked.
//...//array == {"no","no","yes","no","","yes",...}for(int i =0; i <99; i++){if(array[i].equals("yes")){// do somethingreturn something;}}// this will stop at i == 2 and will not reach the end of for loop
This would explain why you would get only first encounter from the array. I assume you want all the pieces of the conversation.
I assume the init() method adds data to the variable. In the code you provided, it doesn't add anything to the array so it is empty. This is why the conditions are never met and string "0" is returned. Also, the function of init() could have been done in the first line:
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
Okay, so, I am working on porting an IM client over from autoit to java, and I'm still rather new to java.
What I am attempting to do is create a 2d array where I can store every user's conversation history in the array next to their name.
Then what I want to do, is, on demand, write this chat history into an edit control, by providing the user's username, thus showing the chat history with that user on screen when asked.
Tried several variations of code.
Array functions: