input - How to scan words from console and store somewhere (Java)? -
i trying input user, in each line user enters 2 words , later comparing 2 words. program needs accept multiple lines means more 1 comparisons. need know how input user multiple lines. (the input stored in txt file , copy , pasted in console if user inputing) this java thanks
you can use hasnext()
function in scanner object
example:
public static void main(string [] args) { scanner scan = new scanner(system.in); system.out.println("write "); while(scan.hasnext()) { /* while there more input read */ } }
Comments
Post a Comment