This is how you cast a variable in java. ☕

int a = (int) b;

Simply put the type you want it to be in parentheses. That’s it! Java will now cast your variable to be the variable type you want.

I hope this helps you with java type casting! This is great practice :)

#java

Java Type Casting Tutorial
1.25 GEEK