Answer to Question #187062 in Java | JSP | JSF for mansoor

Question #187062

Write a class with name ArrayDemo . This class has an array which should be initialized by user as given below. write a function with name display in this class.Call this display function in main function. [4 marks]

                                              -1 4 1 6  3 8  5 10 7 12


1
Expert's answer
2021-05-01T15:23:55-0400
public class ArrayDemo
{

    public static void display(int[] numbers)
    {
        for(int number:numbers)
            System.out.print(number+" ");
    }
    public static void main(String[] args)
    {
        int[] numbers = {-1 ,4, 1, 6,  3, 8,  5 ,10, 7 ,12};
        display(numbers);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS