java - length method to an array made from split method failed -
i have :
scanner scan = new scanner(system.in); string str = scan.nextline(); string[] stringarray = str.split(" "); int arraylength = stringarray.length();
my problem have error length()
method. cannot find symbol.
(my string has spaces.)
length property , not function. need remove parenthesis , work. int arraylength = stringarray.length;
when length()
, means calling function , not property. hope help.
java string split
No comments:
Post a Comment