Ticker

6/recent/ticker-posts

L6, Long Data Type, Usages of the Long wrapper class, package q10747

Long Data Type, Usages of the Long wrapper class :-

The Long class wraps a primitive long value.

This class provides constants and methods that are useful while working with large numbers. For example it has a method Long.parseLong(String s, int radix) which can be used to convert a string value representing a binary, octal, hex or a decimal integer within the valid range of a long.
long x = Long.parseLong("C", 16);
//parses the string literal "C" using base-16 and returns decimal 12 as a long

long y = Long.parseLong("380");
//parses the string literal "380" using base-10 and returns decimal 380 as a long
In the below code, the main method of CalculateDifference will be passed two arguments. Both the values can be any number between Long.MIN_VALUE to Long.MAX_VALUE .
You can assume that the string values passed in args[0] and args[1] will always contain numbers represented in base-10.
Complete the below code so that it produces the correct output.

package q10747 :-


Post a Comment

0 Comments