exception is null code example
Example 1: exception is null
try
{
}
catch (WebException webEx)
{
Logger.Log("Error while tried to do something. Error: " + webEx.Message);
}
catch (Exception ex)
{
Logger.Log("Error while tried to do something. Error: " + ex.Message);
}
Example 2: exception e is null c#
try
{
}
catch (WebException webEx)
{
Logger.Log("Error while tried to do something. Error: " + webEx.Message);
}
catch (Exception ex)
{
Logger.Log("Error while tried to do something. Error: " + ex.Message);
}
Example 3: null pointer exception method
public class MainClass {
public static void main(String[] args) {
anotherTest();
test();
}
public static void test() {
System.out.println("Printed from the test method.");
}
public static void anotherTest() {
System.out.println("Printed from the anotherTest method.");
}
}