Java Convert int to long

Java Convert int to long

We can convert int to long in java using assignment operator. There is nothing to do extra because lower type can be converted to higher type implicitly.

It is also known as implicit type casting or type promotion.


Java int to long Example

Let's see the simple code to convert int to long in java.

Test it Now

Output:

200

Java int to Long Example

We can convert int value to Long object by instantiating Long class or calling Long.valueOf() method.

Let's see the simple code to convert int to Long in java.

Test it Now

Output:

100
100




Latest Courses