java.util.scanner - Unable to take multiple String input using scanner in java -
i have been trying program in have concat 3 strings in java.i taking input user using scanner.it compiles perfect when run it,it gives me error:
exception in thread "main" java.util.inputmismatchexception @ java.util.scanner.throwfor(scanner.java:864) @ java.util.scanner.next(scanner.java:1485) @ java.util.scanner.nextint(scanner.java:2117) @ java.util.scanner.nextint(scanner.java:2076) @ night.main(night.java:10)
this code:
import java.lang.*; import java.util.*; class demo { public static void main(string[] args) { string fn; string mn; string ln; string fmn, lmn; scanner sc = new scanner(system.in); fn = sc.nextline(); mn = sc.nextline(); ln = sc.nextline(); fmn = fn.concat(mn); lmn = fmn.concat(ln); system.out.println("the full name of candidate : " + lmn); } }
i believe current code in demo
class working fine. can check again?! exception night.main(night.java:10)
. if still have same error, can check if there night class in working space?!
hope help.
Comments
Post a Comment