How To Convert An Array To String in Java 8? | Java 8 Examples | Java Inspires



Hi Guys,

Welcome to Java Inspires.

In this post, we will see how to convert an array to string in java 8.

How To Convert An Array To String in Java 8? | Java 8 Examples | Java Inspires

Java8Example.java

package com.javainspires.java8example;

import java.util.Arrays;

/**
 * 
 * @author Java Inspires
 *
 */
public class Java8Example {

	public static void main(String[] args) {

		// define int array
		int[] intArr = { 99, 46, 22, 88, 01, 6, 44, 5 };
		// convert the array to string
		String arrStr = Arrays.toString(intArr);
		// print the string
		System.out.println("Array as string");
		System.out.println(arrStr);
	}

}

Output 

Array as string
[99, 46, 22, 88, 1, 6, 44, 5]

Thank You


Post a Comment

Previous Post Next Post