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

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


Please Help Members By Posting Answers For Below Questions

Why pointers are not used in java?

1062


What is jit compiler ?

945


Explain java coding standards for interfaces?

1069


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?

943


Do extraneous variables affect validity?

879


What do you mean by chromounits in java8?

901


What is bitwise complement?

936


What is meant by stack and queue?

1009


Why is stringbuffer thread safe?

1011


Difference between this() and super() ?

1029


How do you use wildcards?

992


Explain about oops concepts.

1073


How to create a fecelet view?

949


What is a heavyweight component?

989


What are the types of exceptions?

1001