Results 1 to 2 of 2
  1. #1
    renu is offline Senior Member
    Join Date
    May 2010
    Posts
    119
    Rep Power
    0

    Question Incompatible type for method. Can't convert java.lang.String to char.

    Hi


    I have an input file , the java program reads every input record and should look for { and } . If it finds { it should replace it with ( and if it finds } it should replace it with )

    So i have added this line to do it :-
    /* read first line from input file */
    input = br.readLine();
    /* replace each } to a left round bracket */
    input = input.replace("}",")");
    /* replace each { to a right round bracket */
    /*input = input.replace("{","(");*/

    and i get this error :-
    Incompatible type for method. Can't convert java.lang.String to char.
    input = input.replace("}",")");


    Can anyone pls help me ..

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,429
    Rep Power
    11

    Default

    What does the API doc say about the parameters of the replace method?
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Convert Char To String
    By fh84 in forum New To Java
    Replies: 15
    Last Post: 10-28-2009, 09:59 PM
  2. Convert Comparable object to string or char
    By ScKaSx in forum New To Java
    Replies: 4
    Last Post: 01-25-2009, 02:02 PM
  3. Replies: 15
    Last Post: 09-29-2008, 07:18 AM
  4. Cannot convert from char to String error
    By sondratheloser in forum New To Java
    Replies: 1
    Last Post: 12-13-2007, 09:28 PM
  5. Can't convert java.lang.String to int.
    By Albert in forum AWT / Swing
    Replies: 2
    Last Post: 07-13-2007, 05:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •