All pastes #281281 Raw Edit

Untitled

public text v1 · immutable
#281281 ·published 2006-12-16 17:39 UTC
rendered paste body
public class twoDArray2 {
	public static void main (String args[]) {

		String[] names = { "Pete", "Cathy", "Graham", "Claude", "Dave" };
		int[][] payRollData = { {437, 6, 25000}, {525, 4, 60000}, {214, 3, 40000}, {639, 4, 35000}, {309, 5, 15000} 

};
		
		for (int row = 0; row<payRollData.length; ++row)
		{
			for (int col = 0; col<payRollData[row].length; ++col)
			{
				System.out.printf("%8d", names[row]);
				System.out.printf("%8d", payRollData[row][col]);
			}
			System.out.println();
		}
	}	
}

Gets this error:

C:\Documents and Settings\Sarah Hunt>java twoDArray2
Exception in thread "main" java.util.IllegalFormatConversionException: d != java
.lang.String
        at java.util.Formatter$FormatSpecifier.failConversion(Unknown Source)
        at java.util.Formatter$FormatSpecifier.printInteger(Unknown Source)
        at java.util.Formatter$FormatSpecifier.print(Unknown Source)
        at java.util.Formatter.format(Unknown Source)
        at java.io.PrintStream.format(Unknown Source)
        at java.io.PrintStream.printf(Unknown Source)
        at twoDArray2.main(twoDArray2.java:11)