FileDocCategorySizeDatePackage
ToStringExample.javaAPI DocExample2258Wed May 18 09:39:00 BST 2005com.discursive.jccook.lang.builders

ToStringExample

public class ToStringExample extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] pArgs)


		// Create a State
		State va = new State( "VA", "Virginia");

		// Create a Birth Date
		Calendar calendar = new GregorianCalendar();
		calendar.set( Calendar.YEAR, 1743 );
		calendar.set( Calendar.MONTH, Calendar.APRIL );
		calendar.set( Calendar.DAY_OF_MONTH, 13 );
		Date dob = calendar.getTime();

		BigDecimal moneyRaised = new BigDecimal( 293829292.93 );		

		// Create a Political Candidate
		PoliticalCandidate candidate = 
			new PoliticalCandidate( "Jefferson", "Thomas", dob, moneyRaised, va );
		
		System.out.println( candidate );

		// Create a Political Candidate
		PoliticalCandidate candidate2 = 
			new PoliticalCandidate( "Jefferson", "Martha", null, null, null );

		// Create a Political Candidate
		PoliticalCandidate candidate3 = 
			new PoliticalCandidate( "Jefferson", "Martha", dob, null, va );

		System.out.println( "Two Jeffersons are still different (should be > 0): " + candidate.compareTo( candidate2 ) );
		System.out.println( "Two Jeffersons are still different (should be < 0): " + candidate2.compareTo( candidate ) );
		System.out.println( "Two Martha Js are the same (should be zero): " + candidate2.compareTo( candidate3 ) );