범위 주석 : /* (내용) */
단축키 - 주석을 사용할 내용을 드래그하여 Ctrl+Shift+/
한 줄 주석 : //(내용)
단축키 - Ctrl+/
출력
System.out.println("");
System.out.prin("");
System.out.printf("");
System.out - 콘솔에 데이터 출력
print() - 내용을 출력하고 자동 줄바꿈X
println() - 내용을 출력하고 자동 줄바꿈
단축키 - sysout 입력후 ctrl+space bar 자동완성
printf() - 변수 값을 여러가지 형식으로 변환하여 출력가능
10진수 정수 - %d
8진수 정수 - %o
16진수 정수 - %x
부동 소수점 - %f
지수 표현 - %e
문자 - %c
문자열 - %s
boolean - %b
public class test { public static void main(String[] args) { System.out.printf("10진수 : %d\n", 99); System.out.printf("8진수 : %o\n", 99); System.out.printf("16진수 : %x\n", 99); System.out.printf("실수 : %.3f\n", 99.54321); System.out.printf("문자 : %c\n", 'a'); System.out.printf("문자열 : %s\n", "가나다"); } }
'JAVA' 카테고리의 다른 글
자바 변수(기본형,참조형,상수) (0) | 2018.03.04 |
---|---|
자바 개발환경 구축(JDK 설치) (0) | 2018.03.04 |