4 Replies Latest reply: Sep 15, 2009 8:15 PM by 807580 RSS

    Creating and Manipulating Strings Question

    807580
      Code:

      import java.util.*;

      class String {
      public static void main(String[] args) {

      String s;
      s="This Is A Sample String";
      System.out.println(s);
      System.out.println(s.substring(9) + s.substring(0,8));

      }
      }

      For some reason, there was a problem with line

      s="This Is A Sample String";

      It didn't work because of incopatible types.

      Also both s.subtring lines had an error at the dot because of cannot find symbol.

      I didn't see aything wrong with the program, but was there something else that should've been imported? Thanks.