167.
You try to execute the following code:
try
{
StreamWriter sw = File.CreateText("hello.txt");
sw.WriteLine("Hello, world!");
}
catch (IOException ex)
{
Console.WriteLine(ex.Message);
}
finally
{
if( sw != null ) sw.Close();
}
What is the result?
View Description
StreamWriter variable should be declared outside of the try block.