[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math

Search:


View post   

>> No.9239378 [View]
File: 11 KB, 364x528, longest word.png [View same] [iqdb] [saucenao] [google]
9239378

I'm trying to write a java program to find the longest word in a sentence.

I feel like this should do it, but it only gives me back the first word of a sentence, regardless of length.

The i value seems to be working how I want it, it will print the first pass that i = 3 and then i = -1, then break. which is how I wanted to set it up.

I've been doing okay so far in my cs course, but loops have been giving me a lot of trouble; especially the nested ones, which is why I try to use them as little as I can get away with.

Navigation
View posts[+24][+48][+96]