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
Why pointers are not used in java?
What is jit compiler ?
Explain java coding standards for interfaces?
Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?
Do extraneous variables affect validity?
What do you mean by chromounits in java8?
What is bitwise complement?
What is meant by stack and queue?
Why is stringbuffer thread safe?
Difference between this() and super() ?
How do you use wildcards?
Explain about oops concepts.
How to create a fecelet view?
What is a heavyweight component?
What are the types of exceptions?