Posty

Wyświetlam posty z etykietą Scanner

Java: Scanner umie ciąć tekst, nawet na inty itp

Niesamowite funkcje Scannera! Oprócz wczytywania tekstu wpisanego przez użytkownika i czytania plików, potrafi on znacznie więcej. Oto cytat ze strony : Parameter Data Type Parameter Description Required/Optional String pattern It is a string specifying the pattern to scan. Required Pattern pattern It is the pattern to scan for specified string. Required Returns Method Returns hasNext() This method returns true if and only if this scanner has another token. hasNext(String pattern) This method returns true if and only if this scanner has another token matching the specified pattern. hasNext(Pattern pattern) This method returns true if and only if this scanner has another token matching the specified pattern. Exceptions IllegalStateException - This method throws exception if the innvocation is done after the scanner has been closed. Compatibility Version Java 1.5 and above Example 1 import  java.util.*;   public   class  Scanne...