Wednesday, 15 July 2015

Java Programs Made Easy

package Good.com;

public class Prog20 {
      static int op;

      public static void abc(String str) {
            if (str.startsWith("-")) {
                  int n = Integer.parseInt(str);
                  n = Math.abs(n);
                  op = n;
            } else
                  op = -1;
      }

      public static void main(String[] args) {
            String str = "-94923";
            abc(str);
            System.out.println(op);
      }


}