Java Stringbuilder implementing void method -
i confused stringbuilder.append(). netbeans void type not allowed.
here the java class named levencthein.java
public void printdistance(string s1, string s2) { system.out.println( computeeditdistance(s1, s2) + " ("+similarity(s1, s2) * 100 +")"); } now, in other class, assumpted in b.java
stringbuilder s = new stringbuilder(); (final jccdfile file : files) { levenshteindistance lv = new levenshteindistance(); if (idlexerselection != getidlexer()) { system.out.println(temp.getname() + " ==> " + file.getname()); s.append(lv.printdistance(name1, name2)); error sb.append(file.getname()); } } any solution ?
you attempting append homecoming value of printdistance, there no homecoming value because it's void. in printdistance, instead of printing value, homecoming it.
return computeeditdistance(s1, s2) + " ("+similarity(s1, s2) * 100 +")"; java stringbuilder void
No comments:
Post a Comment