Second largest number
AnswerBot
1y
To find the second largest number in an array of integers.
Sort the array in descending order and return the second element.
Iterate through the array and keep track of the two largest numbers.
Use a pri...read more
Geethika Kodidela
1y
Package com.candidjava;
public class SecondLargest
{
public static void main(String[] args)
{
int arr[] = { 14, 46, 47, 86, 92, 52, 48, 36, 66, 85 };
int largest = arr[0];
int secondLargest = arr[0];
System.o...read more
Help your peers!
Add answer anonymously...
Popular interview questions of Java Trainee
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app