#5 What is typecasting in Java? #shorts #javaprogramming

preview_player
Показать описание
In this short we explain how not to answer in Java interview when questioned about What is typecasting in Java? #shorts #javaprogramming

Generally candidates assume typecasting to convert from one datatype to another. But that's not enough to answer.

It is also required to explain types of Typecasting in Java:
Widening (Implicit) Casting:
Widening casting occurs when you convert a smaller data type to a larger data type. It is done automatically by the Java compiler, as it is considered a safe operation that does not result in a loss of data.

Narrowing (Explicit) Casting:
Narrowing casting occurs when you convert a larger data type to a smaller data type. It must be done explicitly by the programmer, as it can result in a loss of data.

Tell in comment section What is your way of giving correct answer?
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Subscribe to our channel and press the bell icon to get regular updates:
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
📌 Social Media
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Copyright © 2023 ScaleUp India - All Rights Reserved
Рекомендации по теме
Комментарии
Автор

Type Casting is assigning a value of one primitive data type to another type either automatically or mannually.

code_concept
Автор

typecasting is convert on to one data type to compatible type .
bcz you can't converd to boolean to another data type .

Digital_Dharma
Автор

the process of converting a variable from one data type to another. There are two types of type casting in Java:

Widening Type Casting (Implicit Type Casting): Automatic conversion of a smaller data type to a larger data type.
Narrowing Type Casting (Explicit Type Casting): Manual conversion of a larger data type to a smaller data type, which may result in data loss.

sanjusanjeev