[Solved] When string.lenght() is 0 throw an exception
Try this out. This should give you Exception. public static void main(String[] args) throws Exception { Scanner keyboard = new Scanner(System.in); System.out.print(“Enter: “); String entry = keyboard.nextLine(); keyboard.close(); if (entry.length() == 0) { throw new Exception(“Exception Found”); } else { String reverse = reverse(entry); if (reverse.length() == 0) { throw new Exception(“Exception Found”); } else … Read more