java - Method not working as Planned? -


scanner adjectives = new scanner(new file("adjectives.txt"));         string[] adjectivearray;         adjectivearray = new string[25];         int counter = 0;         while (counter<25)         {             string in = adjectives.next();             fixcapitalization(in);             adjectivearray[counter]=in;             counter++;         } 

is main code , method i'm trying use is...

public static string fixcapitalization(string original) {     string modified = original.tolowercase();     return character.touppercase(modified.charat(0)) + modified.substring(1);  } 

i'm attempting fix capitalization of word before put array, later on in program noticed words in adjectivearray hadn't been capitalized? going wrong?

string immutable

replace

fixcapitalization(in); adjectivearray[counter] = in; 

with

adjectivearray[counter] = fixcapitalization(in); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -