Trio - { return "[" +...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 public class Trio <A>{ public Trio(){ //default constructor } public Trio(A a, A b, A c){ first = a second = b third = c } public A first(){ return first } public A second(){ return second } public A third(){ return third } public boolean contains(A a){ boolean value = false if(a == first || a == second || a == third) value = true return value } public String toString()
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { return &quot;[&quot; + first.toString() + &quot;, &quot; + second.toString() + &quot;, &quot; + third.toString() + &quot;]&quot; } public A first public A second public A third /*public static void main(String args) { Trio&lt;String&gt; tester = new Trio&lt;String&gt;(&quot;abc&quot;,&quot;def&quot;,&quot;ghi&quot;) System.out.println(&quot;Show Results:&quot; + tester.toString()) } */ }...
View Full Document

This note was uploaded on 09/16/2009 for the course CS 3345 taught by Professor Ozbirn during the Spring '08 term at University of Texas at Dallas, Richardson.

Ask a homework question - tutors are online