﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Reading a word from console </Title>
            <Description> Expansion snippet for reading a word from console. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> Word </ID>
                    <Default> strWord </Default>
                    <ToolTip> Variable to hold a word read from console. </ToolTip>
                </Literal>
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[String $Word$ = "";  
//string variable to store the word read from console
try
{
        java.io.BufferedReader objBuffReader = new java.io.BufferedReader(
                                                new java.io.InputStreamReader(
                                                java.lang.System.in));
        String strLine = objBuffReader.readLine();
        java.util.StringTokenizer strToken = new java.util.StringTokenizer(strLine);
        $Word$ = strToken.nextToken();
    }
catch (java.io.IOException e)
{
        System.out.println("Error: Invalid IO operation.");
}
catch (java.util.NoSuchElementException  ex)
{
    System.out.println("Error: Invalid word.");
}
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
