Sample code for use of try and catch:
try
{
temp = Apexpages.currentPage().getParameters().get(‘memNam’);
}
catch(Exception e)
{
temp = e.getMessage();
}
try
{
temp = Apexpages.currentPage().getParameters().get(‘memNam’);
}
catch(Exception e)
{
temp = e.getMessage();
}