0

I new in Java Development, but have expirience in other languages. I choosen Java, because it have got strong typing, but when I started to learning simple examples i can't find simple type checking in editors. I tried Eclipse and IDEA, but in both i didn't get any warnings in this simple code

public class BlockTest {
    public static void main(String[] args) {
       int x;
       x = 'a';
       System.out.print(x);
    }
}

I tried equate int variable to string value and didn't get any warnings. Why this is not error for editors? When work in other language I always heared how usefull strong types. Why i can't see it? Or maybe checking only input and output function types? Or I should install some spacial linter or use something 'strict' mode in editor?

Denis Savenko
  • 829
  • 1
  • 13
  • 29
  • 1
    `char` is still an integral type. Each character is mapped to an integer value, which can be stored in an `int`. – Logan Mar 11 '19 at 05:57
  • Ouuu... I didn't think about it. Tried double or not one character and got error. Thank you for this point. Interested, how often missed such an error when checking – Denis Savenko Mar 11 '19 at 06:04
  • No problem! The behavior was inherited from C. – Logan Mar 11 '19 at 06:04

0 Answers0