Q. What will be the output of the following Java code snippet?
int a = random.nextInt(15) + 1;

  • (A) Random number between 1 to 15, including 1 and 15
  • (B) Random number between 1 to 15, excluding 15
  • (C) Random number between 1 to 15, excluding 1
  • (D) Random number between 1 to 15, excluding 1 and 15
πŸ’¬ Discuss
βœ… Correct Answer: (A) Random number between 1 to 15, including 1 and 15

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
126
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Praveen Singh
Publisher
πŸ“ˆ
83%
Success Rate