Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RepeatText {
- public static void main(String[] args){
- try {
- int count = Integer.parseInt(args[1]);
- for (int i = 0; i < count; i++){
- System.out.println(args[0]);
- }
- } catch (NumberFormatException ex1){
- System.out.println("Second argument must be positive number!");
- } catch (ArrayIndexOutOfBoundsException ex2) {
- try {
- System.out.println(args[0]);
- }
- catch (ArrayIndexOutOfBoundsException ex3) {
- System.out.println("No arguments!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement