Jordan Lee Burnes
Jordan Lee Burnes

Reputation: 140

No suitable method found for println... Java

I am trying to test my arrays that I stored in variables by displaying the first int/double/string stored under a method called displayMessage. However for some reason whenever I make the method I get the error, No suitable method found for println..., for my Println statement. Any and all help would be fantastic! thanks in advance, below is the code.

public class InventoryClass {
    private int[] itemNumber = {1,2,3,4,5,6,7,8,9,10};
    private String[] productName={"CD1","CD2","CD3","CD4","CD5","CD6","CD7","CD8","CD9","CD10"};
    private int[] unitsInStock={2,14,22,11,5,20,7,9,14,31};
    private double[] productPrice={4.99, 9.99, 4.99, 9.99, 7.99, 7.99, 14.50, 9.99, 9.99, 4.99};




    public void displayMessage(){
        System.out.println(itemNumber[1], productName[1], unitsInStock[1], productPrice[1]);}

Upvotes: 1

Views: 3204

Answers (1)

Chris
Chris

Reputation: 478

Change:

System.out.println(itemNumber[1], productName[1], unitsInStock[1], productPrice[1]);

To:

System.out.println(itemNumber[1] +" "+ productName[1] +" "+ unitsInStock[1] +" "+ productPrice[1]);

Upvotes: 1

Related Questions