/* package whatever; // don't place package name! */ import java.util.*;import java.lang.*;import java.io.*; /* Name of the class has to be "Main" only if the class is public. */class Ideone{ public static String left2(String str) { return str.substring(2)+str.substring(0,2); } public static void main (String[] args) throws java.lang.Exception { left2("a"); }}
Standard input is empty
Standard output is empty
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1875) at Ideone.left2(Main.java:12) at Ideone.main(Main.java:16)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!