Comments on: Java Program to Find Second Largest Number in An Array https://java2blog.com/find-second-largest-number-in-array-java/?utm_source=rss&utm_medium=rss&utm_campaign=find-second-largest-number-in-array-java A blog on Java, Python and C++ programming languages Wed, 15 Nov 2023 10:57:00 +0000 hourly 1 https://wordpress.org/?v=6.2.9 By: Arpit Mandliya https://java2blog.com/find-second-largest-number-in-array-java/#comment-21656 Fri, 03 Jan 2020 16:49:59 +0000 http://www.java2blog.com/?p=100#comment-21656 Missed the edge case!! Thank you for bringing it up. Fixed it.

]]>
By: Sangamesh https://java2blog.com/find-second-largest-number-in-array-java/#comment-21591 Thu, 02 Jan 2020 11:06:21 +0000 http://www.java2blog.com/?p=100#comment-21591 If we change else id condition code works fine all cases,
else if (array[i] > secondHighest && array[i] != highest){
secondHighest = array[i];
}

]]>
By: Sangamesh https://java2blog.com/find-second-largest-number-in-array-java/#comment-21590 Thu, 02 Jan 2020 10:51:22 +0000 http://www.java2blog.com/?p=100#comment-21590 Hi, this code will fail if an array contains duplicate which is also happened to be largest element.
Example: arr[] = {7, 8, 8, 1, 4, 2}

]]>
By: Smitha Byrapatna https://java2blog.com/find-second-largest-number-in-array-java/#comment-10970 Wed, 18 Apr 2018 17:14:07 +0000 http://www.java2blog.com/?p=100#comment-10970 I love your blog. Thanks a ton to you. One of the best website to get ready for interviews.

]]>