Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Duplicate in string
//Title of this code //'main' method must be in a class 'Rextester'. public class Rextester { public void printTwoMaxNumbers(int[] nums){ int maxOne = 0; int maxTwo = 0; for(int n:nums){ if(maxOne < n){ maxTwo = maxOne; maxOne =n; } else if(maxTwo < n){ maxTwo = n; } } System.out.println("First Max Number: "+maxOne); System.out.println("Second Max Number: "+maxTwo); } public static void main(String a[]){ int num[] = {5,34,78,2,45,1,99,23}; Rextester tmn = new Rextester(); tmn.printTwoMaxNumbers(num); } }
run
|
edit
|
history
|
help
0
anonymous abstract class
http://stackoverflow.com/questions/23175927/how-to-clone-object-defined-by-interface
Java Q4
parameter const
1.5
Remove duplicates in string
Assignment for Web Software Developer position
Path finding given 2D array
Sorted Array
Graph adjacency list representation