printf();

decimal point : 십진수(숫자)

System.out.printf("%5d");

%c : 영문자(대/소) 한글자 출력 

%s : 문자열 출력할때

%f : 부동소수점 출력, 단정도 실수형

%lf : 배정도 실수형 출력

%e : 지수승 출력

package test;

public class test0421 {
	public static void main(String [] args){
		char a = 's';
		String b = "abcdefg";
		int f =12300;
		float c = 34.56789f;
		double d = 1231465.565165156;
		System.out.printf("%c \n", a);
		System.out.printf("%s \n", b);
		System.out.printf("%d \n", f);
		System.out.printf("%f \n", c);
		System.out.printf("%e \n", d);
		
	}

'코딩이야기 > JAVA' 카테고리의 다른 글

[JAVA] 인터페이스  (0) 2020.04.22
[JAVA] 상속  (0) 2020.04.22
[JAVA] 랜덤 클래스  (0) 2020.04.20
[JAVA] 배열의 기초!  (1) 2020.04.17
[JAVA]대소문자 변환  (0) 2020.04.08

+ Recent posts