The use of several printouts and stringtokenizer about Exception in Java

Source: Internet
Author: User
Tags getmessage
Today do SSD 3 Quiz 1, try to throw out the effect of the exception (see Icarnegieinfoapplication.java):
Nfe.printstacktrace ()/write a large paragraph
System.out.println (Nfe.getmessage ()); The output result is just "for input string" AA "
System.out.println (Nfe.getcause ()); Output "NULL"
System.out.println (Nfe.getlocalizedmessage ()); The same as. GetMessage
Stderr.println (Nfe.getmessage ());/the same as. GetMessage


Then there is the use of StringTokenizer. Start Vivizhyy only by the impression of writing parameters, the number of the results are not correct.
The beginning is written stringtokenizer StringTokenizer = new StringTokenizer (":");
This will still have the ":" In the results, after checking the API, plus the need to be divided into strings as the first argument, so. That ":" will be divided. (Refer to Secondscalculator)

Ps.
StringTokenizer (String str)
Constructs a string tokenizer for the specified string.
StringTokenizer (String str,string Delim)
Constructs a string tokenizer for the specified string.
StringTokenizer (String str,string Delim, Boolean returndelims)
Constructs a string tokenizer for the specified string.
The third use of VIVIZHYY has not been played yet.

And there is a way to stringtokenizer this class: Counttokens () calculates the number of times so this tokenizer ' s nexttoken methods can be C Alled before it generates an exception.

Well, I have finished quiz, so happy.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.