How do I display the contents of this array?
This might be a stupid question to some people. Sadly I am a rookie programmer. This is my task: Display the contents of the array by using a
method that receives the array as a parameter and uses System.out. and here is my code:
Code :
import java.util.Scanner;
public class Lab10_Ex3
{
public static void main(String[] args)
{
String[] scientists = {"Einsten", "Newton", "Copernicus", "Kepler"};
strings(scientists);
}
public static void strings(String[] array)
{
Scanner keyboard = new Scanner(System.in);
System.out.print(array);
}
}
for some reason this comes up as the output:
[Ljava.lang.String;@61de33
Re: How do I display the contents of this array?
Re: How do I display the contents of this array?
Quote:
Originally Posted by
mjballa
Nevermind I got it!
Kindly mark it as SOLVED