Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class example {
- public static void main(String[] args) {
- try {
- int x = Integer.parseInt(args[0]);
- int y = Integer.parseInt(args[1]);
- if (x==y && x >25) {
- System.out.println("x is large, and so is y");
- }
- else if (x != y) {
- System.out.println("x is not equal to y");
- }
- else if (x > 15){
- System.out.println("x still somewhat large");
- }
- else if (x >= 1) {
- System.out.println("x positive at least");
- }
- else if (x == 0) {
- System.out.println("x is 0");
- }
- else if (x < 0) {
- System.out.println("x is negitive");
- }
- else {
- System.out.println("x is not a number");
- }
- }
- catch (NumberFormatException|ArrayIndexOutOfBoundsException e){
- System.out.println("\r\nX and Y are not Integers\r\nto run this program:\r\njava example x y");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment