• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger


Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My applet program using StringBuffer class is compiling fine.
But while running it gives "MethodNotFoundError" for method
delete() and substring(), while appened()method is working fine.
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you just put in you code also.
It would be easier.
I hope you have you used StringBuffer.delete() and StringBuffer.substring().

Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am Sayeed. I made a program as per your contents. Yes it
gets problem when i tried to add delete() and it gives
message nosuchMethodFound error. But when i used StringTokenizer
it can delete everything very nicely. Kindly see the following
program and test it. I deleted Bhubwan from "Hi Bhubwan Tewari"
N.B. when you add delete( int start, int end) mehtod, make sure that you delete method along with parameters because there is no delete method without parameter inside StringBuffer class.

import java.util.*;
class STTest{
public static void main( String[] argv ){
String s="Hi Bhuwan Tewari";
StringTokenizer st=new StringTokenizer(s);
StringBuffer sb = new StringBuffer(30);

while(st.hasMoreTokens()) {

String sp=(st.nextToken());
sb.append(sp).append(" ");

System.out.println("This line we are getting after deleting from
pos 4 to pos 10 i.e. Bhuwan: ");

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am just guessing here, but check and make sure that the methods you want to use are not "new" as of Java 1.2. The JVM that ships with most browsesrs is surprisingly old, so unless you are using the Java Plug-In, you will have problems using recent additions to Java (I ran into this while trying to use methods of the Vector class).
The two armies met. But instead of battle, they decided to eat some pie and contemplate this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic