• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

charAt() problem.. plz help..

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have write this code :

import javax.swing.*;
public class strexample
{
public static void main(String[] args)
{
String s1="hello how r u";
String output;
output += "\nThe String reversed is: ";

for(int count = s1.length()-1;count>=0;count--)
{
output += s1.chatAt(1);
}

JOptionPane.showMessageDialog(null, output, "String Example", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}


and getting this problem....

---------- Compile Java ----------
strexample.java:15: cannot resolve symbol
symbol : method chatAt (int)
location: class java.lang.String
output += s1.chatAt(1);
^
1 error

plz.. help..
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You've fatfingered "charAt" to "chatAt".
 
Vikas Rawat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeff Bosch:
You've fatfingered "charAt" to "chatAt".



i dont understand
 
Jeff Bosch
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

symbol : method chatAt (int)



Your compiler complained that it couldn't find the method "chatAt". The method name is simply misspelled. If you correct your source code to invoke the "charAt" method, it will work. There is no "chatAt" method. (Note the 't' in the fourth character of your method name.)

Hope this helps...
 
Vikas Rawat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ohh.. yes...

thanks for helping me...
 
Jeff Bosch
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
Yeah, but how did the squirrel get in there? Was it because of the tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic