Java program for count of number of words in table -


i have written java code finds no.of words in table.

it working within loop, value becomes 0 once exits loop.

please me correct value.

int f=0; int fc=0; statement sta4=connection.createstatement(); resultset rs4=sta4.executequery("select * db1"); while(rs4.next()) {     word[f]=rs4.getstring(1).replace("$", "");     system.out.println(" sentece ="+word[f]);     fc= countwords(word[f]);     system.out.println("the sentence has "+ fc + " words");     f++; } system.out.println(" count  =" + fc); 

int f=0; int fc=0; statement sta4=connection.createstatement(); resultset rs4=sta4.executequery("select * db1"); while(rs4.next()) {     word[f]=rs4.getstring(1).replace("$", "");     system.out.println(" sentece ="+word[f]);     int fctemp= countwords(word[f]);     system.out.println("the sentence has "+ fctemp + " words");     fc += fctemp;     f++; } system.out.println(" count  =" + fc); 

use this. werent adding fc


Comments