Skip to content
Advertisement

I want to return a formatted Phone Number with use substring but odd thing return

I’m new to java. why this don’t work ?? this must get something like this formatPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) and after that return (123) 456-7890

Thanks for the answers.

JavaScript

Advertisement

Answer

When using the toString(); method in a primitive type array the result is the location in the memory e.x “[I@1b28cdfa”

If you want to copy your array of numbers in a String just use the StringBuilder

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement