Type Conversion #4
Hey, Guys in this vedio we will be learning Type Conversion in java
Plz, subcribe the channel if u are new.......
Click Here to Subcribe : https://www.youtube.com/channel/UC2Fzl6hVg5wvQwnnmNiL9HQ
Click Here to Access the Playlist : https://youtube.com/playlist?list=PLc2KNNLpynPGmlziX-7F6qrQvrW6wKDNs
Code of the Video:
public class TypeConversation
{
/*
* What is Type Conversation ?
Type Conversion is a method or process that converts a data type into another
data type in both ways manually and automatically.
The automatic conversion is done by the compiler and manual conversion performed by the programmer.
There are two Types of Conversation
1] Implicit conversion
2] Explicit conversion
*/
public static void main(String [] args){
/*
* 1] Implicit conversion
Converting a lower data type into a higher one is called Implicit Type Conversation.
The conversion is done by the compiler.
i) Both data types must be compatible with each other.
ii) The target type must be larger than the source type.
*/
byte a = 119;
// Converting byte to int
int b = a;
// Converting int to long
long c = b;
// Converting long to float
float d = c;
System.out.println(a + " : byte");
System.out.println(b + " : int");
System.out.println(c + " : long");
System.out.println(d + " : float");
}
}
public class Explicit
{
/*
Converting a higher data type into a lower one is called Explicit Type Conversation.
It is done manually by the programmer.
If we do not perform casting then the compiler reports a compile-time error.
i) This is useful for incompatible data types where automatic conversion cannot be done.
ii) Here, target type should be smaller than source type
*/
public static void main(String [] args){
// Explicit TypeConversion
double a = 23.6;
// Converting double to long
long b = (long)a;
// Converting long to int
int c = (int)b;
// Converting int to byte
byte d = (byte) c;
// Printing the Values
System.out.println(a + " : double");
System.out.println(b + " : long");
System.out.println(c + " : int");
System.out.println(d + " : byte");
}
}
Music Credit goes to : https://youtu.be/Tv6WImqSuxA
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Type Conversion #4», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.