-2

Here is the code I got the space output. I didn't figure out if '\u0000' means the space or something else.

`package com.string.test;   
 class CharTest {   
   char y;   
   public static void main(String args[]){  
     CharTest test = new CharTest();   
     System.out.println("Default value of char:----" + test.y + "----");   
   }   
} `
Bimal Sharma
  • 134
  • 14
  • Not wanting to use my hammer, but this doesn't seem like a duplicate to me. The question here is "has it changed in Java 8". OP seems to know that it was the null character (that is, `\u0000`, not Java null) previously. – Dawood ibn Kareem Dec 04 '15 at 22:12
  • I am not getting null output for default char.Please try some code in java 8 and correct me if i am wrong. – Bimal Sharma Dec 04 '15 at 22:21
  • Why don't you show us the code that you tried, so someone can point out why it doesn't give you what you expect? I don't think anybody is going to come to this site, and write code to prove to themselves what they already know. – Dawood ibn Kareem Dec 05 '15 at 05:14
  • I have posted the code below. – Bimal Sharma Dec 08 '15 at 14:50
  • { package com.string.test; class CharTest { char y; public static void main(String args[]) { CharTest test = new CharTest(); System.out.println("Default value of char:----" + test.y + "----"); } } //please check this code i got space output } – Bimal Sharma Dec 08 '15 at 14:53
  • @PrayagSharma If you have another question, then [ask](http://stackoverflow.com/questions/ask) a _new_ question. Don't edit another ones closed question, just to match your concerns. – Tom Dec 12 '15 at 10:10

1 Answers1

0

A char has a default value of 'u0000'. Reference this article: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

drewfiss90
  • 53
  • 5