DOC PREVIEW
UNF COP 2551 - Study Notes

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Example of String Tokenizer… while ((state=getData(input))!= null)//reads text file line by line { StringTokenizer st = new StringTokenizer(state); while (st.hasMoreTokens())//parses fields and assigns to variables { stName = st.nextToken(); stCapital = st.nextToken(); stAbbreviation = st.nextToken(); stPopulation = st.nextToken(); stRegion = st.nextToken(); stNumber = st.nextToken(); }//end while int intPopulation = Integer.parseInt(stPopulation);Used Buffered Reader in lieu of Scanner objects. //prompts user for two character state abbreviattion to search objects InputStreamReader reader = new InputStreamReader(System.in); BufferedReader keyboard = new BufferedReader(reader); try { System.out.print("To search the state records, please enter" + " the 2 character state abbreviation (i.e. TX): "); stateInputAbb = keyboard.readLine( ); System.out.println(); } catch (IOException e) { }Static Use private static int count = 0;… /** * Static Method - returns static count of number of objects created * @return count*/ public static int getCount() { return count;


View Full Document

UNF COP 2551 - Study Notes

Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?