I have the user input a sentence (example " Hello this is some jello "). I already have that complete by having a method to do this. What the method does is take a user input (.nextLine) then stores the words of the sentence into String[] words and I use the split function to break up the sentence into individual words. What I want to do is find in a given word, how many characters are in the word (length method without using .length()), then read in a sentence(already created a method to obtain user input then I called it in the main to execute), put each word into an object(Maybe a loop but where? I tried Word[] words = new Word[1]; Word is the public class and words comes from String[] words if that is correct, but I get LWord;32c8f6f8), then I can call the function that was created to get the length of the word in the object. Once I know the lengths I want to show the user the words that have the same length. Just looking for a push in the right direction to see if I can come up with anything I apologize if this is confusing and I will clarify it there are any questions. Thanks!
FUTURECompEng
0
Newbie Poster
Recommended Answers
Jump to Posttry by overriding Object's toString method. if you don't, the application 'll just print the reference to the Object, and that looks like what you described above.
Jump to PostThe toString() method would be in the Word class.
All 8 Replies
stultuske
1,116
Posting Maven
Featured Poster
NormR1
563
Posting Sage
Team Colleague
FUTURECompEng
0
Newbie Poster
stultuske
1,116
Posting Maven
Featured Poster
FUTURECompEng
0
Newbie Poster
NormR1
563
Posting Sage
Team Colleague
FUTURECompEng
0
Newbie Poster
FUTURECompEng
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.