Skip to content
Advertisement

Tag: default

Is there a default type for numbers in Java

If I write something like this Which type has the ’18’? Is it int or byte? Or doesn’t it have a type yet? It can’t be int, because something like this is correct: And this is incorrect: EDIT: I think I found the right part in the spec at Assignment Conversion : The compile-time narrowing of constants means that code

Advertisement