next和hasnext
Given a List of integers and we have to traverse, print all its element using next() and hasNext() methods.
给定一个整数列表,我们必须遍历,使用next()和hasNext()方法打印其所有元素。
什么是hasNex()和next()方法? (What are hasNex() and next() methods?)
Both are the library methods of java.util.Scanner class.
两者都是java.util.Scanner类的库方法。
Method hasNext() returns 'true'/'false' - If collection has more values/elements, it returns true otherwise it returns false.
方法hasNext()返回'true'/'false'-如果collection具有更多的值/元素,则返回true,否则返回false 。
Method next() returns the nex