Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public class Main {
  2. public static void main(String[] args) throws Exception {
  3.  
  4. if (args.length > 2 || args.length == 1) throw new Exception("Invalid input data");
  5.  
  6.  
  7. if (args.length == 0) {
  8. TableOfMultiplication table = new TableOfMultiplication();
  9. table.printTable();
  10. } else {
  11. try {
  12. Integer.parseInt(args[0]);
  13. Integer.parseInt(args[1]);
  14. if (Integer.parseInt(args[0]) <= 0 || Integer.parseInt(args[1]) <= 0) throw new Exception("Invalid input data");
  15. TableOfMultiplication table = new TableOfMultiplication(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
  16. table.printTable();
  17. } catch (NumberFormatException e) {
  18. System.out.println("Input is not a number");
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement