File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

charAt() problem.. plz help..

 
Vikas Rawat
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • 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..
 
Jeff Bosch
Ranch Hand
Posts: 805
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've fatfingered "charAt" to "chatAt".
 
Vikas Rawat
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeff Bosch:
You've fatfingered "charAt" to "chatAt".


i dont understand
 
Jeff Bosch
Ranch Hand
Posts: 805
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ohh.. yes...

thanks for helping me...
 
Jeff Bosch
Ranch Hand
Posts: 805
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic