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

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -