1 Reply Latest reply: Nov 24, 2007 7:41 PM by 807600 RSS

    char set to null?

    807600
      So, I have no experience with using null, but the code I am working on requires char to be set to null, specifically values in a char array.

      According to the book I'm using, "null is a special constant that can be used to give a value to any variable of any class type". However, when I try to set an item in the char array to null, the compiler returns

      Error: incompatible types
      found : <nulltype>
      required: char

      So, I'm wondering if this is possible at all. Or how to do it exactly.

      Thanks.
        • 1. Re: char set to null?
          807600
          kiacg wrote:
          So, I have no experience with using null, but the code I am working on requires char to be set to null, specifically values in a char array.

          According to the book I'm using, "null is a special constant that can be used to give a value to any variable of any class type". However, when I try to set an item in the char array to null, the compiler returns

          Error: incompatible types
          found : <nulltype>
          required: char

          So, I'm wondering if this is possible at all. Or how to do it exactly.

          Thanks.
          If you are talking about objects, you are correct, but for characters "null" is a term used to describe the character '\0' that is, the first ascii character, with unicode value \u0000 or hex value 0x00. It's an old comms term that predates object oriented programming by a couple of decades.