print numbers using ToString in java

-2

The project scribble plus it did not print the numbers inside the [] ...

package tostring2;

import java.util.Arrays;


public class ToString2 {

    public static String ToString2(int [] a) {

       int idades [] = {12,20,30,40};
       int i;

       for (i = 0; i < 4 ; i++){
          System.out.println(idades[i]);
       }
       for (i=0; i < idades.length;i++){
          System.out.println("idades "+Arrays.toString(idades));
       }
}
    
asked by anonymous 10.08.2017 / 22:54

1 answer

0

You created a method but did not call it.

Create a main method and call it inside it. Example:

public static void main (String[] args)
{
    ToString2();
}

See working on Ideone: link

    
10.08.2017 / 23:00