Confirm/Success:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Confirm,’Sample Success Message’));
Warning:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Warning,’Sample Warning Message’));
Informational:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,’Sample Informational Message’));
Error:
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,’Sample Error Message’));