Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

"times 2" in Java?

Name: Anonymous 2009-04-11 18:16

import static java.lang.System.out;
public class Times2 {
  public static void main(final String[] args) {
    for (byte i = 1; i < 11; i++) {
      out.println(2 + " x " + i + " = " + 2 * i);
    }
  }
}


public class Times2 {
  public static void main(final String[] args) {
    for (byte i = 1; i < 11; i++) {
      System.out.println(2 + " x " + i + " = " + 2 * i);
    }
  }
}


Am I ENTERPRISE enough?

Name: Anonymous 2009-04-11 19:50

This is a horrible excuse for an enterprise application. The fact you have to enter "2 *|x i" twice is creating duplicate code that makes your program difficult to maintain. I recommend using reflection to build a method at runtime so you only need to specify the operator and operand once.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List