HW1 - System.out.println("min2" +...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Retrieves the minimum 2 elements of an array. public class HW1 { // Declare AnyType here p public AnyType[] min2(AnyType [] args){ \\ Your code here } public static void main (String [] args) { Double [] lst = {0.8052073333964869, 0.55711336431441, 0.9357305463700772, 0.33734630152033773, 0.7246207029953734, 0.9156548649888094, 0.9488702100922455, 0.4679401410715889, 0.6044203730726063, 0.07821903477916259}; HW1<Double> A = new HW1<Double>(); Comparable [] result = A.min2(lst); System.out.println("min1" + result[0]);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System.out.println(&quot;min2&quot; + result[1]); String slst = {&quot;bba&quot;, &quot;bab&quot;, &quot;cab&quot;, &quot;abc&quot;, &quot;baa&quot;, &quot;stocks&quot;, &quot;in&quot;, &quot;the&quot;, &quot;asian&quot;, &quot;markets&quot;, &quot;experienced&quot;, &quot;dramatic&quot;, &quot;drop&quot;, &quot;on&quot;, &quot;tuesday,&quot;, &quot;even&quot;, &quot;though&quot;, &quot;the&quot;, &quot;indexes&quot;, &quot;ultimately&quot;, &quot;erased&quot;, &quot;a&quot;, &quot;part&quot;, &quot;of&quot;, &quot;the&quot;, &quot;losses&quot;, &quot;during&quot;, &quot;the&quot;, &quot;day.&quot;}; HW1&lt;String&gt; B = new HW1&lt;String&gt;(); result = B.min2(slst); System.out.println(&quot;min1: &quot; + result[0]); System.out.println(&quot;min2: &quot; + result[1]); } }...
View Full Document

Ask a homework question - tutors are online