adplus-dvertising
frame-decoration

Question

What is the output of this program?
    import java.util.*;
    class Array 
    {
        public static void main(String args[]) 
        {
            int array[] = new int [5];
            for (int i = 5; i > 0; i--)
                array[5 - i] = i;
            Arrays.sort(array);
            for (int i = 0; i < 5; ++i)
             System.out.print(array[i]);;
        }
    }

a.

12345

b.

54321

c.

1234

d.

5432

Posted under Java Programming

Answer: (a).12345

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. Which class is used to generate random number?

Q. Which method is used to generate boolean random values in java?

Q. What is the return type of Math.random() method?

Q. Random is a final class?

Q. What is the range of numbers returned by Math.random() method?

Q. How many bits are used for generating random numbers?

Q. What would be the output of following code snippet?

int a = random.nextInt(15) + 1;

Q. What would be the output of following code snippet?

int a = random.nextInt(7) + 4;

Q. Math.random() guarantees uniqueness?

Q. What is the signature of Math.random() method?

Q. Which of these class produce objects with respect to geographical locations?

Q. Which of these methods is not a Locale class?

Q. Which of these class can generate pseudorandom numbers?

Q. Which of these method of Locale class can be used to obtain country of operation?

Q. Which of these is a method can generate a boolean output?

Q. What is the use of Observable class?

Q. Which of these methods is used to notify observer the change in observed object?

Q. Which of these methods calls update() method?

Q. Which of these methods is called when observed object has changed?

Q. Which of these classes can schedule task for execution in future?