java


What is actual default value of a char in java? [duplicate]


This question already has an answer here:
what's the default value of char?
13 answers
class CHar
{
public static void main(String []l)
{
char j='\u0000';
System.out.println("value of char j="+j);
}
}
When I print the value of j then it prints nothing it means null value, but java dic says the default value of char is '\u0000' with which I agree, but the default value should be print. Instead of printing the default value it prints
C:\Users\Mohit-Pc\Desktop\Java Array>java CHar
value of char j=
That it is nothing means null. I'm still confused, whether I use instead of char default value, null then it generates an error:
CHar.java:5: error: incompatible types: cannot be converted to
char char j=null;
A char with value 0 is the NUL character. It is a non-printing character and does not display as anything. Traditionally, C-style strings use a NUL character to mark the end of a string.
Note that the NUL character is different from the Java null. NUL is a primitive char value, while null is a reference value. The char type cannot hold a value of null, but an object type like java.lang.Character can.
If you want to print the numeric value of a char, cast it to int first.

Related Links

insert method for Priority Queue using Linked Lists
RealList in RealmObject not automatically loaded
Java renameTo() failing some time, where I can see OS logs
JButton can't be resolved inside actionListener
Log4j Version 1.x: How to create different log files for different users?
How to print graph without excess lines
Getting Firebase displayName to write
Jersey client REST API generates http 403 error
Method won't save variable. Instead just printing out as 'null' [duplicate]
Create enum variables inside a singleton class in Java
Image from Desktop not displaying (Java)
Not able to click on element although click in not throwing error
JUnit AssertionFailedError: Text in the file differs in java
Select elements from joined ElementCollection
GUI calculation issue [closed]
jersey rest service with tomcat not working with welcome file configuration in web.xml

Categories

HOME
twitter
testing
vim
jdo
webpack
keras
reflection
plot
bpmn
cplex
webstorm
analysis
spring-jdbc
yarn
ravendb
mvvmcross
swagger-ui
add
slurm
gitpitch
here-api
imacros
hex-editors
uitypeeditor
text-rendering
custom-wordpress-pages
xlsxwriter
riot.js
clickonce
lcd
opennlp
maxmind
ejabberd-module
vision
nouislider
sql-server-2012-express
google-rich-snippets
uisplitview
stringtemplate
hybridauth
ghost4j
fusionpbx
mesos-chronos
cubic-spline
hibernate-tools
filepicker
promela
logparser
ionicons
nstextview
setter
nsarray
word-vba-mac
dstu2-fhir
jwplayer7
pagedlist
essence
python-stackless
pagerank
ios4
tform
freedesktop.org
qdialog
varargs
responsive-images
mono-embedding
operation
system.reflection
block-device
camanjs
mdt
asp.net-web-api-odata
xcode-6.2
java-metro-framework
braille
cloud-connect
xsockets.net
jsctypes
dir
clipper
first-responder
chrono
amazon-appstore
spring-portlet-mvc
locationlistener
servicehost
pyinotify
createwindow
gallio
libs
anti-piracy
procedural-music
zune
commodore

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile