Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) throws Exception {
- if (args.length > 2 || args.length == 1) throw new Exception("Invalid input data");
- if (args.length == 0) {
- TableOfMultiplication table = new TableOfMultiplication();
- table.printTable();
- } else {
- try {
- Integer.parseInt(args[0]);
- Integer.parseInt(args[1]);
- if (Integer.parseInt(args[0]) <= 0 || Integer.parseInt(args[1]) <= 0) throw new Exception("Invalid input data");
- TableOfMultiplication table = new TableOfMultiplication(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
- table.printTable();
- } catch (NumberFormatException e) {
- System.out.println("Input is not a number");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement