how to read float array from command line in java? -
how can store float value in array command line , when user input character "q" system stop inputting values command line.
i haven't tested it, wrote using scanner docs
scanner sc = new scanner(system.in); while(sc.hasnext()) { string next = sc.next(); if("q".equals(next)) break; float value = new float(next); system.out.println("float: "+value); }
Comments
Post a Comment