by Dinesh Thakur Category: Java Language

Type Conversion

Type Conversion is that which converts the one data type into another for example converting a int into float converting a float into double The Type Conversion is that which automatically converts the one data type into another but remember we can store a large data type into the other for ex we can t store a float into int because a float is greater than int Type Conversion is Also Called as Promotion of data Because we are Converting one Lower data type into higher data type So this is Performed Automatically by java  compiler

Type Casting

When a user can convert the one higher data type into lower data type then it is called as the type casting Remember the type Conversion is performed by the compiler but a casting is done by the user for ex converting a float into int Always Remember that when we use the Type Conversion then it is called the promotion when we use the type casting means when we convert a large data tote into another then it is called as the demotion when we use the type casting then we can loss some data. Like We are converting float into int then it will Truncate the Fractional part from the data  Like (int) 123.78 Will gives use only 123 this will Truncate the Fractional Part and Returns only Int value

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.