Pages

Sunday, 20 November 2016

Problem 38 - Exception Handling

import java.util.Scanner;
class Exceptions {
  public static void main(String[] args) {
 
  String languages[] = { "C", "C++", "Java", "Perl", "Python" };
 
  try {
    for (int c = 1; c <= 5; c++) {
      System.out.println(languages[c]);
    }
  }
  catch (Exception e) {
    System.out.println(e);
  }
  }
}


0 comments:

Post a Comment