Type casting and Type conversion in java
Type casting and Type conversion in java. The process of converting one primitive data type to another primitive data type is called type conversion or conversion. Or The process of converting value of one data type to another data type is called type casting or type conversion. There are two types of type conversion/casting. 1.Implicit type casting 2.Explicit type casting 1.implicit or widening or automatic type conversion : It is converted from lower data type to higher data type automatically by compiler. Or It is converted from small data type to large data type automatically by compiler. Or It is an auto conversion performed by the compiler between two compatible data types using java's type promotion rules. It is performed by compiler itself. It is also called type promotion. Example : int x=5; float y; y=x; System.out.println("x="+x); System.out.println("y="+y); results : x=5 y=5.0 2.Explicit or manual or narrowing type conversion ...