Answers for "cannot set char to null value java"

5

set char value to null java

//Primitives data types aren't nullable. However, you can use the following
  
 c[i]= '\0'; 
OR
 c[i] = 0;
Posted by: Guest on June-18-2021
5

cannot set char field to null value java

//The primitive datatype int isn't nullable. 
//What you can do is set its value to 0
char [] c= {'a','b','c','d'};
c[2] = 0; //now c becomes {'a','b',0,'d'}
Posted by: Guest on June-18-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language