• 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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
 
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!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic