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 |
What are the types of methodology?
When does Exception occurs?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?
When we will use an Interface and Abstract class?
what is dynamic method dispatch ?
27 Answers Fidelity, MUET, SDSF,
How the elements are organized in GridBagLayout?
How can we make sure main() is the last thread to finish in java program?
How do you use spaces in java?
Mention a package that is used for linked list class in java.
How many bytes is a string?
Can we call virtual funciton in a constructor ?
Package1 and Package2 both have a method name lets say "methodA" with different implementation. When I import both the packages in a java class how can I use both the methods?