Implicit typecasting not working if passing integer value as argument in java
问题 In the following code , implicit typecasting for an integer value 9 take place and assigned to variable of byte datatype which is of size 8 bits. class Demo1 { public static void main(String args[]) { byte b=9; System.out.println(b); } } The code happily compiled and executed . but when i wrote the following code it gave me compilation error class Demo2 { void func1(byte b) { System.out.println(b); } public static void main(String[] args) { Demo2 d1=new Demo2(); d1.func1(9); } } please