Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


write java code to print second max number in the array

Answers were Sorted based on User's Feedback



write java code to print second max number in the array..

Answer / rajesh s

If we give negative values, what would be the Rajaraman
code begaves????

Is This Answer Correct ?    0 Yes 1 No

write java code to print second max number in the array..

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

Post New Answer

More Core Java Interview Questions

How do you escape in java?

0 Answers  


How to display arraylist values in java?

0 Answers  


what is real-time example of runtime polymorphism and compile time polymorphism

4 Answers   SLK Group,


Can static methods be overridden?

5 Answers   Bravura Solutions,


What is meant by method overriding?

0 Answers  


How many types of methods are there in java?

0 Answers  


What are actual parameters?

0 Answers  


Can we use both this () and super () in a constructor?

0 Answers  


Can a for statement loop indefinitely?

3 Answers  


What is the flag in java?

0 Answers  


what is abstract method with example?

6 Answers   Infosys, Virtusa,


Can list have duplicates in java?

0 Answers  


Categories