Code example for StringTokenizer

Methods: hasMoreElements

0
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // Expected 
        } 
 
        stringTokenizer = new StringTokenizer(new String(), (String) null);
        try { 
            stringTokenizer.hasMoreElements();
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // Expected 
        } 
    } 
 
    public void test_hasMoreTokens_NPE() { 
        StringTokenizer stringTokenizer = new StringTokenizer(new String(),
                (String) null, true);
        try { 
            stringTokenizer.hasMoreTokens();
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {