Converting arrays to strings - Java Language Basics

Java examples for Language Basics:Array

Description

Converting arrays to strings

Demo Code

import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    int[] lotto = new int[6];
    //from ww  w  . jav a 2  s  .c o  m
    for (int i = 0; i < 6; i++)
      lotto[i] = (int) (Math.random() * 100) + 1;
    
    System.out.println(Arrays.toString(lotto));
  }

}

Related Tutorials