Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

MethodNotFoundError

 
Greenhorn
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
Hi
Can you just put in you code also.
It would be easier.
I hope you have you used StringBuffer.delete() and StringBuffer.substring().

------------------
Suneel
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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"
String.
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(sb);
}

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

Thanks,
Newaz
 
Greenhorn
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).
-B
 
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic