|
|
@ -10,39 +10,39 @@ public class TestPrimitives { |
|
|
|
this.printFloat(1.23F);// 11 |
|
|
|
this.printFloat(1.23F);// 11 |
|
|
|
this.printDouble(1.23D);// 12 |
|
|
|
this.printDouble(1.23D);// 12 |
|
|
|
this.printChar('Z');// 13 |
|
|
|
this.printChar('Z');// 13 |
|
|
|
System.out.println(String.format("%b, %d, %d, %d", new Object[]{this.getBoolean(), this.getByte(), this.getShort(), this.getInt()}));// 15 |
|
|
|
System.out.println(String.format("%b, %d, %d, %d", this.getBoolean(), this.getByte(), this.getShort(), this.getInt()));// 15 |
|
|
|
}// 16 |
|
|
|
}// 16 |
|
|
|
|
|
|
|
|
|
|
|
public void printBoolean(boolean b) { |
|
|
|
public void printBoolean(boolean b) { |
|
|
|
System.out.println(String.format("%b", new Object[]{b}));// 19 |
|
|
|
System.out.println(String.format("%b", b));// 19 |
|
|
|
}// 20 |
|
|
|
}// 20 |
|
|
|
|
|
|
|
|
|
|
|
public void printByte(byte b) { |
|
|
|
public void printByte(byte b) { |
|
|
|
System.out.println(String.format("%d", new Object[]{b}));// 23 |
|
|
|
System.out.println(String.format("%d", b));// 23 |
|
|
|
}// 24 |
|
|
|
}// 24 |
|
|
|
|
|
|
|
|
|
|
|
public void printShort(short s) { |
|
|
|
public void printShort(short s) { |
|
|
|
System.out.println(String.format("%d", new Object[]{s}));// 27 |
|
|
|
System.out.println(String.format("%d", s));// 27 |
|
|
|
}// 28 |
|
|
|
}// 28 |
|
|
|
|
|
|
|
|
|
|
|
public void printInt(int i) { |
|
|
|
public void printInt(int i) { |
|
|
|
System.out.println(String.format("%d", new Object[]{i}));// 31 |
|
|
|
System.out.println(String.format("%d", i));// 31 |
|
|
|
}// 32 |
|
|
|
}// 32 |
|
|
|
|
|
|
|
|
|
|
|
public void printLong(long l) { |
|
|
|
public void printLong(long l) { |
|
|
|
System.out.println(String.format("%d", new Object[]{l}));// 35 |
|
|
|
System.out.println(String.format("%d", l));// 35 |
|
|
|
}// 36 |
|
|
|
}// 36 |
|
|
|
|
|
|
|
|
|
|
|
public void printFloat(float f) { |
|
|
|
public void printFloat(float f) { |
|
|
|
System.out.println(String.format("%f", new Object[]{f}));// 39 |
|
|
|
System.out.println(String.format("%f", f));// 39 |
|
|
|
}// 40 |
|
|
|
}// 40 |
|
|
|
|
|
|
|
|
|
|
|
public void printDouble(double d) { |
|
|
|
public void printDouble(double d) { |
|
|
|
System.out.println(String.format("%f", new Object[]{d}));// 43 |
|
|
|
System.out.println(String.format("%f", d));// 43 |
|
|
|
}// 44 |
|
|
|
}// 44 |
|
|
|
|
|
|
|
|
|
|
|
public void printChar(char c) { |
|
|
|
public void printChar(char c) { |
|
|
|
System.out.println(String.format("%c", new Object[]{c}));// 47 |
|
|
|
System.out.println(String.format("%c", c));// 47 |
|
|
|
}// 48 |
|
|
|
}// 48 |
|
|
|
|
|
|
|
|
|
|
|
public boolean getBoolean() { |
|
|
|
public boolean getBoolean() { |
|
|
|