write java code to print second max number in the array
Answer Posted / murali
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class SecondMax {
public static void main(String[] args) {
String [] str={"3","4","2","1"};
List<String> ls=Arrays.asList(str);
Collections.sort(ls);
System.out.println(ls.size()-1);
}
}
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
Which object oriented concept is achieved by using overloading and overriding?
What is the internal implementation of set in java?
What is the purpose of the return statement?
Is string a class in java?
How do you trim a space in java?
Where import statement is used in a java program?
What is data type example?
How many types of constructors are used in java?
Is void a keyword in java?
What are java packages? What is the significance of packages?
Is main an identifier?
What is a protected method?
Is hashset ordered java?
is there a separate stack for each thread in java? : Java thread
Can we clone singleton object?