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
What are the features of junit?
How do you replace a string in java?
give an example for encapsulation?
What is public static?
What is return used for in java?
Is null false in java?
What is the size of boolean variable?
What is method reference in java?
What is a parameter in java?
Explain about interrupt() method of thread class ?
What is difference between classpath and path variables in java?
Can we override the static method?
When is the finally clause of a try-catch-finally statement executed?
How can we make a class singleton?
What are the advantages of autoboxing?