0
Does anyone know how to write an anagram checker code in Java
I am doing (string fundatmentals) homework and an optional bonus question asks us to write a basic java code that can check if two strings are anagrams of one another. So far, I understand that they have to be the same length and same number of letters, but i just can't figure out how to build that. I have an if statement that checks the length of both strings but after that I'm lost. Please help and thank you for your time!
2 odpowiedzi
0
Ok I saw, on a google search, references to first use .toCharArray() and then Array.sort().. this looks like it will work.
I guess I was looking for a simple string method to solve it since we haven't learned about importing classes yet. But thank you!
0
Oh that's probably what they wanted. Wow no wonder it was optional. Haha thanks again!