- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to convert an array to string in java?
The Arrays class of the java.util package provides toString() methods for all primitive data types and object. These methods accept an array and return its string representation.
Therefore, to convert an array to string pass the required array to this method.
Example
import java.util.Arrays; public class ArrayToString { public static void main(String args[]) throws Exception { int[] myArray = {23, 93, 56, 92, 39}; String str = Arrays.toString(myArray); System.out.println(str); } }
Output
[23, 93, 56, 92, 39]
- Related Articles
- How to convert comma seperated java string to an array.
- how to convert Object array to String array in java
- Convert an ArrayList of String to a String array in Java
- how to convert vector to string array in java
- Write a program to convert an array to String in Java?
- How to convert/store a string of numbers in to an array in java?
- How to convert string to array of integers in java?
- How to convert hex string to byte Array in Java?
- How to convert a Double array to a String array in java?
- How to convert an object array to an integer array in Java?
- How to convert an array into JavaScript string?
- Convert string to char array in Java
- Convert Char array to String in Java
- How to convert a byte array to hex string in Java?
- How to convert a String to an enum in Java?

Advertisements