write java code to print second max number in the array
Answers were Sorted based on User's Feedback
Answer / rajesh s
If we give negative values, what would be the Rajaraman
code begaves????
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / 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 |
How do you escape in java?
How to display arraylist values in java?
what is real-time example of runtime polymorphism and compile time polymorphism
Can static methods be overridden?
What is meant by method overriding?
How many types of methods are there in java?
What are actual parameters?
Can we use both this () and super () in a constructor?
Can a for statement loop indefinitely?
What is the flag in java?
what is abstract method with example?
Can list have duplicates in java?