Project: Aligning Characters and Strings with printf()
Write a program that demonstrates the formatting of characters and strings using printf() and/or sprintf() style output. Your program should reproduce the output shown using the following variables:
- c1 = "C" (or 'C' in C++)
- c2 = "-"
- c3 = 51
- c4 = 80
- c5 = 0x4f
- s = "Boba Fett"
Output
$ javac -Xlint AligningCharactersAndStringsWithPrintf.java
$ java -ea AligningCharactersAndStringsWithPrintf
c1: C
c2: -
c3: 3
c4: P
c5: O
s: Boba Fett
s: Boba
s: | Boba|
s: |Boba |