Link to home
Start Free TrialLog in
Avatar of dbaseek
dbaseek

asked on

output of the program

class getCharDemo {
  public static void main(String args[]) {
    String s="This is a demo for getChars method.";
    int start=10;
    int end=14;
    char buf[]=new char [end - start];
    //char buf1[]=new char [end - start];
    s.getChars(start, end,buf,0);
    //s.getChars(start, end,buf1,0);
    System.out.println(buf);
    System.out.println(buf1);
   }
}

the output of this program is: demo
I want to get an output start 5 end 11
I want to display both the result..
Please help me?
Avatar of william007
william007

   String s="This is a demo for getChars method.";

    System.out.println(s.substring(5-1,11-1));
Change this
 
    int start=10;
    int end=14;
 
to
 
    int start=5;
    int end=11;
ASKER CERTIFIED SOLUTION
Avatar of william007
william007

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial