Character cannot be dereferenced?

//output from compiler
partA.java:72: char cannot be dereferenced
                String theCharacterToBeAString = checkValue.toString();
                                                           ^the code
public boolean isOperator(char checkValue)
          String theCharacterToBeAString = checkValue.toString();
          if(theCharacterToBeAString.equals("+"))
               return true;
          else
               return false;
     any ideas?

Woops!
public static boolean isOperator(char checkValue) {
    return checkValue ==  '+';

Similar Messages

  • Boolean cannot be dereferenced

    Hi all any help would be great:
    Im getting these errors:
    KhanAccount.java:41: boolean cannot be dereferenced
    for(int i = 0; i < passwd.length(); i++)
    ^
    KhanAccount.java:42: boolean cannot be dereferenced
    if (Character.isDigit(passwd.charAt(i)))
    ^
    KhanAccount.java:45: boolean cannot be dereferenced
    if (passwd.length() >= 6 && hasDigit)
    ^
    3 errors
    This is the code:
    (main method)
    import java.text.*;
    import javax.swing.*;
    public class KhanPassword
    public static void main (String [] args)
    KhanAccount oneacct = new KhanAccount ();
    inputacct (oneacct);
    System.exit(0);
    public static KhanAccount inputacct (KhanAccount aacct)
    /* If an invalid password is entered (or the two entries do not match),
    the user should be prompted to try again. */
    /* Continuously reads a pair of passwords until the two match.*/
    do { // Continuously reads the password until it is a valid one.
    do {
    String password = JOptionPane.showInputDialog("Enter password:\n"
    + "(must be at least six characters long and have at least one digit)");
    aacct.setusername(un);
    /* display a message indicating whether it is valid or not */
    if (!aacct.setPassword(passwd))
    JOptionPane.showMessageDialog(null, "Invalid password!");
    else {
    JOptionPane.showMessageDialog(null, "Valid password!");
    break;
    while (true);
    /* The password should be prompted for twice */
    String reenter = JOptionPane.showInputDialog("Re-enter password:");
    /* the entries should match or a message provided to the user. */
    if (!passwd.equals(reenter))
    JOptionPane.showMessageDialog(null, "Two passwords don't match!");
    else
    JOptionPane.showMessageDialog(null, "Two passwords match!");
    } while (!passwd.equals(reenter));
    return aacct;
    (called method)
    public class KhanAccount
    public String username;
    public boolean password;
    public String reenter;
    public boolean passwd;
    public static void KhanAccount (){};
         public String getusername()
         return username;
         public boolean getpassword()
         return password;
         public void setusername (String un)
         username = un;
    public boolean setPassword()
    password = passwd;
    /* check if contains digit*/
    boolean hasDigit = false;
    for(int i = 0; i < passwd.length(); i++)
    if (Character.isDigit(passwd.charAt(i)))
    hasDigit = true;
    if (passwd.length() >= 6 && hasDigit)
    password = passwd;
    return true;
    } else
    return false;
    }

    Btw, isn't better to initiate hasDigit to true and then when
    a character is wrong set hasDigit = false and quit loop
    with break or so?
    And methods called set.. often returns nothing if they return
    boolean they are often named with is... or so isPasswd
    I've learned basic methods should be divided into three types:
    constructors starts with make..
    modifiers , set..
    predicats , is..
    //jF
    /* check if contains digit*/
    boolean hasDigit = false;
    for(int i = 0; i < passwd.length(); i++)
    if (Character.isDigit(passwd.charAt(i)))
    hasDigit = true;
    if (passwd.length() >= 6 && hasDigit)
    password = passwd;
    return true;
    } else
    return false;
    }

  • The ''' character cannot be used in a path.

    I am trying to import HTML files from a previous version of online help into a newer version, but am getting the following error:
    "The filename is invalid. The ''' character cannot be used in a path."
    I have checked filenames of all HTML topics but I could not see '' or any other special characters having been used. This is happening for all HTML files in the older release of the help, not just one. Used version 9 for creating the older version, and that's what I am using for the new version. Please advise.
    If this error cannot be resolved, I'll have to manually copy the content from older topics into topics created in the new help.

    Hi there
    If you are importing several topics at once, you may need to use the "divide and conquer" approach. The goal is to sort exactly which of the files is giving you the issue. Once you identify the specific file, you will then be able to ascertain the exact character that is giving you fits.
    As a general note, I'd be looking at the files using Windows Explorer. ANY character other than a-z, A-Z, 0-9 or the underscore do I consider suspect.
    Best of luck to you in resolving this! Rick

  • In Unicode Programs , the "-" CHARACTER CANNOT APPEAR IN NAME

    HI,
       I am checking the routines for the transfer rules(0SRM_GLSPEND_INVOICE) in the ODS Object (0GLS_INV).
    WARNING :In Unicode programs, the "-" character cannot appear in names, as it does here in the name
    " L-LOCAL_ID"
    this is only before unicode conversion .
    thanks & regards
    subba reddy.

    HI,
       I am checking the routines for the transfer rules(0SRM_GLSPEND_INVOICE) in the ODS Object (0GLS_INV).
    WARNING :In Unicode programs, the "-" character cannot appear in names, as it does here in the name
    " L-LOCAL_ID"
    this is only before unicode conversion .
    thanks & regards
    subba reddy.

  • In unicode program, the "-" character cannot appear in names, as it ......

    Hello,
    Very Good Evevning!
    When I am actiavting my program I am receiving the following error message.
    In unicode program, the "-" character cannot appear in names, as it does here in the name "CHAR-".
    What is this error message and what does it mean...?
    Any suggetsions would be appreciated...
    Regards,
    Kittu

    Hello,
    When we activate, it does not throw any error message...The above Unicode error message will not stop us from activating our program.
    It seems that this is due to inconsistency between the servers...If any one has any explonation regarding the Above Unicode error then please let me know.
    Regards,
    Kittu

  • Float cannot be dereferenced

    Hi,
    I get the following compilation error message:
    "float cannot be dereferenced"
    and i don't know what it meens.
    My code was compiling until i add the intValue methode in the last line.
    Here is the part of code :
    Dimension d,i;
    d = getSize(); // i get the size of the frame
    i = _imPanel.getSize();       // i get the size of an element in this frame
    float hp = i.height/d.height; // i calculate a ratio between those 2 size
    float wp = i.width/d.width; // for each dimansion
    _imPanel.setPreferredSize(new Dimension((getWidth()*wp).intValue(),(getHeight()*hp).intValue())); 
    // and i apply a new dimension to the element int the frame using the ration and the new size of the frame.
    As the ratio is a float and Dimension needs int in parameters, i decided to use the intValue methode to cast the float into int.
    That's it.

    Hello,
    Your problem is that you are trying to use a primitive type as if it were an object!
    You cannot call methods on the primitive types (int, float, double, etc.). Therefore, your line should be converted from:
    Dimension((getWidth()*wp).intValue(),(getHeight()*hp).ntValue()));to Dimension(new Float(getWidth()*wp).intValue(), new Float(getHeight()*hp).intValue()));Which could be done better by directly casting the values:
    Dimension((int)(getWidth()*wp), (int)(getHeight()*hp));Manuel Amago.

  • Character cannot be deferenced

    what does character cannot be deferenced mean?
    heres my code, i get 4 character cannot be deferenced errors.
    import java.io.*;
    class intputoutput
        public static void main (String[] args)
           InputStreamReader inStream = new InputStreamReader (System.in);
             BufferedReader stdin = new BufferedReader (inStream);
           System.out.println("Enter single characters");
               char i, o;
              String sinput, soutput;
              do
              sinput = stdin.readLine();
              i = sinput.charAt(0);
                   if (i.isUpperCase())
                   o = 'i' + 32;
                   o.toString(soutput);
                   else if ('i'.isLowerCase())
                   o = 'i' - 32;
                      o.toString(soutput);
              System.out.println(soutput);
              while(soutput.compareTo(".")!=0);
    }

    okay, i got the problem, the class name was different than the filename, by mistake. but now, if i input a lowercase letter, it shows a capital "I" and if i put in an uppercase letter or a symbol (&, *, $...) it shows a "?".

  • Error : char cannot be dereferenced

    I wrote this program for my test in high school. I am getting 1 error and cannot fix it. can any1 please tell me how to fix this error. The following is the program and the rror message "-
    I AM NEW HERE so i would really BENEFIT from ANY HELP !
    class testing
              static int[] search(char list[], char target) {
                   int brand[] = new int [list.length];
                   for (int i=0; i<list.length; i++) {
                        if (list[i] == target)
                        brand[i] = target.positionOf();
                   return brand;
              } // end method
              public static void main (String str[]) {
                   char list[] = {'M', 'B', 'A', 'J', 'P', 'J','M', 'J'};
                   char target = (str[0].charAt(0));
                   System.out.print ("The list = ");
                   for (int i =0; i<list.length; i++)
                        System.out.print(list[i] + ", ");
                   System.out.println();
    System.out.println ("Target letter " + target + " has been found in position " + search(list,target) + ".");
              } // end main
         } // end class     
    Error :
    C:\JPadPro\MyProjects\testing.java:14: char cannot be dereferenced
         brand[i] = target.positionOf();
    ^
    1 error
    Finished

    My program question was --> Write a program to find a symbol from a list of symbols. Your search method should return all positions in which the target symbol is found.
    According to your solution I changed to indexOf() but still i get the same error.
    class testing
              static int[] search(char list[], char target) {
                   int brand[] = new int [list.length];
                   for (int i=0; i<list.length; i++) {
                        if (list[i] == target)
                        brand[ i ] = (list[ i ].indexOf(target));
                   return brand;
              } // end method
              public static void main (String str[]) {
                   char list[] = {'M', 'B', 'A', 'J', 'P', 'J','M', 'J'};
                   char target = str[0].charAt(0);
                   System.out.print ("The list = ");
                   for (int i =0; i<list.length; i++)
                        System.out.print(list[i] + ", ");
                   System.out.println();
                   System.out.println ("Target letter " + target + " has been found in position " + search(list,target) + ".");
              } // end main
         } // end class     
    Error =
    The current directory is: C:\JPadPro\MyProjects
    C:\JPadPro\MyProjects\testing.java:14: char cannot be dereferenced
              brand[i] = (list.indexOf(target));
    ^
    1 error
    Finished

  • Some character cannot  be transfered by Transformer

    as i transfer a document to string, the character transfer to "&#158707;"
    , the original word is "&#55386;&#57331;"
    how can i solve the problems,
    thanks

    thanks for your reply,
    the charset was made by others,
    the problem i find is that,
    eg. the word, "��" , after transfer, it become "&1258;" form as i write in a text file
    (this example is not real, since the character cannot display here),
    but as i use brower to view , it works properly.

  • ERROR: int cannot be dereferenced

    hi everyone i am trying to copmile the following code
    public void refreshGUI() {
            MessageBoardQueries MBQ = new MessageBoardQueries();
            Date date = Calendar.getInstance().getTime();
            DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
            String argDate = df.format(date).toString();
            int pNumber = MBQ.queryPending(argDate);
            int aNumber = MBQ.queryAccepted(argDate);
            int dNumber = MBQ.queryDeclined(argDate);
            pendingNumberField.setText(pNumber.toString());
            acceptedNumberField.setText(MBQ.queryAccepted(argDate));
            declinedNumberField.setText(MBQ.queryDeclined(argDate));
        }but i keep getting the error:
    int cannot be dereferenced on the line
    pendingNumberField.setText(pNumber.toString());
    does anyone know why?

    because int is a primitive datatype, hence doesn't inherit from java.lang.Object, and as such doesn't have a toString method
    try Integer.toString(pNumber) or String.valueOf(pNumber). either is equally valid

  • "int cannot be dereferenced" error.. help me please

    I'm working with an array list class called PersonList and it uses attributes from a normal class called Person.
    I would like to make this method PrintPerson inside the PersonList class that should search for a specific Person given the ID as parameter to the method. the method should print all info of the Person if found, otherwise a message saying id is not valid.
    I solved it like this:
    public void PrintPerson(int id)
              System.out.println("Enter ID of the person ");
              id = Stdin.readInteger();
              //search the ID if it is in the List
              int i=0;
              while
              ((i<next)&&(!(list.getID().equals(id))))
              i++;
              //if found
              if (i<next)
                   list[i].OutputWindow();}//display the object ouput of this ID
                   else{
                   System.out.println("The following ID: " id "is not valid!");
              }//end if
         }// end of method
    my problem is with this code:
    ((i<next)&&(!(list.getID().equals(id))))
    I get this error "int cannot be dereferenced"
    what should I do? help me please
    -- Matt

    list.getID() == id                                                                                                                                                                                                                               

  • Chinese Character cannot be decoded

    hi,
    I would like to implement two JSP pages. The first JSP is just a html form, which is used to submit unicoded chinese data to a target JSP file.
    The target JSP file received those data and display.
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> is added in the first JSP file. As a result, data will be submitted in UTF-8 format.
    In target JSP, I used the following code to recieve and decode data:
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%
    String para = request.getParameter("para"); // where para is name of received parameter
    byte[] bytes = para.getBytes();
    para = new String(bytes, "UTF-8");
    out.println("Recieved character: " + para);
    %>
    My Problem:
    After I submitted chinese characters from the first JSP file, only some of them can be displayed on target JSP. Some of those characters are missing.
    For example, when I input "�@", target JSP can display the character. On the other hand, when I input "�p", nothing is displayed. But I know that variable "bytes" stored 3 bytes for each chinese character. I would like ask why
    para = new String(bytes, "UTF-8");
    cannot encode properly. Is anything wrong about my coding?
    Thx

    More information can be provided.
    OS: Windows 2000 server
    web server: iPlanet
    P.S. : I have set the Character set to UTF-8 in iPlanet.
    thx.
    hi,
    I would like to implement two JSP pages. The
    The first JSP is just a html form, which is used to
    submit unicoded chinese data to a target JSP file.
    The target JSP file received those data and
    and display.
    <meta http-equiv="Content-Type"
    ype" content="text/html; charset=UTF-8"> is added in
    the first JSP file. As a result, data will be
    submitted in UTF-8 format.
    In target JSP, I used the following code to
    to recieve and decode data:
    <%@ page contentType="text/html; charset=UTF-8"
    F-8" %>
    <%
    String para = request.getParameter("para"); //
    // where para is name of received parameter
    byte[] bytes = para.getBytes();
    para = new String(bytes, "UTF-8");
    out.println("Recieved character: " + para);
    %>
    My Problem:
    After I submitted chinese characters from the
    m the first JSP file, only some of them can be
    displayed on target JSP. Some of those characters are
    missing.
    For example, when I input "�@", target JSP can
    P can display the character. On the other hand, when I
    input "�p", nothing is displayed. But I know that
    variable "bytes" stored 3 bytes for each chinese
    character. I would like ask why
    para = new String(bytes, "UTF-8");
    cannot encode properly. Is anything wrong about my
    coding?
    Thx

  • Special Character " " cannot get to work

    Hi,
    I have a dynamic text box. The AS code I have is:
    ring_txt.htmlText = "<a href='
    http://www.ring.com//webring.php?action=rand'><</a>"
    I have replaced the < with %3c but it doesn't work. If I
    wanted to use the character ">" instead it works fine without
    any special code ! How do I place the "<" symbol in the text box
    Thanks,
    Paul

    quote:
    Originally posted by:
    kglad
    there's an error in your html tags. you have an extra <
    before your a href closure.
    correct that. if there's still a problem post a link to the
    minimal fla that displays the issue.
    I think that's his problem. He wants to make that < the
    clickable text which is why he's wrapped it with an anchor tag.
    If &lt; doesn't work, I don't know what to you tell you
    Erik

  • Window 8.1 Chinese character cannot display properly in a game even though I have downloaded and install all chinese language packs

    Hi,
    The operation system for my computer is Window 8.1. I am currently trying to install a chinese game. Even though I have downloaded and install all the chinese language pack, I have even set the regional language locale to chinese (similified / traditional),
    the chinese characters will not display properly in the game. Some people told me i need to set the locale to Chinese PRC, but I am not sure where to download this PRC language pack for window 8.1 (as I only have chinese simplified and chinese traditional).
    I would greatly appreciate if someone can give me a hand in solving this problem. Thank you for your help in advance. 

    Hi,
    The operation system for my computer is Window 8.1. I am currently trying to install a chinese game. Even though I have downloaded and install all the chinese language pack, I have even set the regional language locale to chinese (similified / traditional),
    the chinese characters will not display properly in the game. Some people told me i need to set the locale to Chinese PRC, but I am not sure where to download this PRC language pack for window 8.1 (as I only have chinese simplified and chinese traditional).
    I would greatly appreciate if someone can give me a hand in solving this problem. Thank you for your help in advance. 
    Hi,
    Please open Region, under administrative -> Language for non-Unicode programs: choose Chinese.
    Kate Li
    TechNet Community Support

  • This program show me "int cannot be dereferenced" as error can you help me?

    public class Factorial{
         public static void main (String [] args){
              if (args.length<1){
                   showmsg("a Integer Please");
                   else if (args.length>1){
                        showmsg ("Only a Integer please");
                        else {
                             int n;
                             try {
                                  n= Integer.parseInt(args[0]);
                             catch (NumberFormatException nfe){
                             showmsg ("a Integer not a String please"); //call to chow message method
                        factorial(n);
         //show a message
         private static void showmsg (String texto){
              System.out.println(texto);
         //factorial procedure
         public static void factorial (int n){
              int fac=1;
              for (int i=1;i<=n;i++){
                   fac*=i;
              String resu = fac.toString();
              showmsg(resu);
    }

    Thanks for your help, I did change other lines too... (if some body wish Run)
    try {
            int n;
            n= Integer.parseInt(args[0]);
            factorial(n);
    catch (NumberFormatException nfe){
                //call to show message method
               showmsg ("a Integer not a String please");
               showmsg (nfe.getMessage());
    }

Maybe you are looking for