Back Java Type Conversions and Type Casting - int to double - double to int - Appficial

0-3
Created By: Appficial
Published At: 2017-09-29
Search Query: Java Type Casting
Tags: appficial java java type conversions type conversions java cast java casting type casting type conversion type cast java int to double java double to int int double floating point numbers integers java tutorial learn java java programming java code how to program java easy easy java java example java examples learn to code java course jdk jre java se java program programming software development java coding
More videos coming soon, please SUBSCRIBE

Sometimes an expression may be a combination of integer and floating-point numbers. Type conversion is when you change one data type to another. Integer to double conversions is fine: 2 becomes 2.0
Double to integer conversion loses precision: 2.6 becomes 2.

Implicit conversion is when the compiler performs a type conversion automatically, as in this example where 2 is converted to 2.0. Type casting is forcing conversion of one type to another by prefixing an expression with (type)

Please SUBSCRIBE to Appficial, and check out more Java Programming Tutorials! http://www.appficial.com

The Basic Parts of a Java Program - Class and Main Method Header and Comments
https://youtu.be/sHEk2DSBnSg

Java Declaring and Initializing Variables
https://youtu.be/Ag8ZH5qRzqM

Naming Java Identifiers - Variables, Methods, and Object Names - Java Tutorial
https://youtu.be/g0NR6Z0ac1A

Java Reserved Keywords - Words like public static void class int double
https://youtu.be/dklOXLDdeqc

Java Primitive Data Types - byte short int long float double char and boolean
https://youtu.be/hHTrxfEWPy0

Java Integers - int long byte and short Integer Variables
https://youtu.be/FsrIsDSgTiQ

Java Floating Point Numbers - float and double
https://youtu.be/6JRufRrO1mQ

Java E Notation - Doing Scientific Notation in a Java Program
https://youtu.be/9tTKa9jEgNs

Java Integer Division and Dividing by Zero - Java Tutorial - Appficial
https://youtu.be/46Ngr6eczpA

Java Basic Math Arithmetic Expressions and Precedence Rules
https://youtu.be/IMavhbsbIeQ

Java Compound Operators - Combined Assignment Arithmetic Operator Examples
https://youtu.be/2TP7XOyCW1o

Java Constants - Constant Variables using Keyword Final
https://youtu.be/cj_5D8-vrfQ

Java Math Class Methods
https://youtu.be/Guhb43pivCs

Java Type Conversions and Type Casting
https://youtu.be/hXxFVXBxQ1Q

How to Convert Binary numbers to Decimal Numbers
https://youtu.be/g1TOLO2FsvQ

Java Characters - The char Primitive Data Type
https://youtu.be/LBQrD2nkKQg

Java Escape Characters
https://youtu.be/jZpSjEGMlUQ

Java String Class
https://youtu.be/3G9IcmbV4Gs

Java Scanner Class
https://youtu.be/A1QXB_6ALDA

Java Integer Overflow
https://youtu.be/lTnUbx5Gi6o

Java Style Guidelines
https://youtu.be/P7xur0m6-do
logo Ask VidTutorAssistant
Comment
or
Question
Your name
Comments with generated responses
@alinemath5030
2021-11-28

how can i assign remaining value of double 0.78 to another variable?

@Appficial

You can multiply it by 100 then set an into to it. int num = (int) doubleNum * 100:

VidTutorAssistant (GPT-4)

Hi @alinemath5030, Java does not have a built-in function to keep the remaining decimal part of a double, but we can create a solution using simple calculations. If you have a double value like 3.78 and you want to get the 0.78 part, you can subtract the integer part from the original value.

For example:
```
double original = 3.78;
int integerPart = (int) original;
double decimalPart = original - integerPart;
```
In this example, 'decimalPart' will hold the value 0.78 and you can assign it to another variable. Hope this helps! Keep coding and exploring!


@muneebahmed1848
2020-06-09

All your videos are quality

@Appficial

Thanks Muneeb

VidTutorAssistant (GPT-4)

Thank you so much @muneebahmed1848! We aim to provide quality and informative content to assist you with your programming journey! We're glad to know you find our videos helpful. Don't hesitate to drop any questions or topics you'd like us to cover in future videos. Happy coding!


@oompaloompa5140
2019-01-01

Thank you, your channel is so underrated!

@Appficial

Thanks I appreciate it!

VidTutorAssistant (GPT-4)

Thanks a lot for your supportive words, @oompaloompa5140! I'm thrilled to know you're finding value in my content. Just like in Java, your positive feedback has made an `implicit conversion` to motivation for me! Stay tuned for more informative videos on Java programming. Happy coding!