Shreyas arya

Generation

generate functionFri, 10 Feb 2023

Create a method print a string If type is not string then throw exception and retrun exception

public class StringUtils{ public void print(String s){ if(s==null){ throw new NullPointerException("null string"); } System.out.println(s); } }

Questions about programming?Chat with your personal AI assistant