Skip to content

Java Challenges

Paul Ambrose edited this page Jul 27, 2020 · 8 revisions

Java Challenges

Java challenges must adhere to this general format:

package packageName;

// @desc This is a description of **methodName**

public class ClassName {

  public static String methodName(String str) {
    return str + str;
  }

  public static void main(String[] args) {
    System.out.println(methodName("Tree"));
    System.out.println(methodName("Truck"));
    System.out.println(methodName("P"));
  }
}
  • packageName can be any valid Java package name.
  • Challenge descriptions are embedded within Java comments (with @desc attribute).
  • Challenge descriptions support markdown.
  • ClassName can be any valid Java class name.
  • methodName can be any valid Java method name.
  • Each System.out.println() will act as a separate input for the user. You can have as many as you want.
  • Please adhere to the same order of declarations as described here.