- 문자열끼리 더해서 출력하면 합쳐서 출력됨
System.out.println("handsukite" + " 입니다."); // handsukite 입니다.
- "를 출력하려면 \"를 입력
System.out.println("handsukite \"25세\""); // handsukite "25세"
- 객체를 생성하지 않고 Math의 클래스를 사용할 수 있음
- PI : 파이값
- floor( ) : 내림값
- ceil( ) : 올림값
System.out.println(Math.PI); // 3.141592653589793
// 내림값
System.out.println(Math.floor(Math.PI));
// 올림값
SyStem.out.println(Math.ceil(Math.PI));
- length( ) : 문자열의 길이를 반환
- replace( ) : 문자열에서 문자를 변경
// 문자열의 길이 반환
System.out.println("handsukite".length()); // 10
// 문자열의 문자 변경
System.out.println("handsukite".replace("u", "oo")); // handsookite
'onYouTube > Java' 카테고리의 다른 글
데이터 타입 (Data Type) (0) | 2021.03.24 |
---|---|
주석과 세미콜론 (0) | 2021.03.24 |
변수 (Variable) (0) | 2021.03.24 |
개발도구와 이클립스 (0) | 2021.03.24 |
[Java 입문 수업] - 생활코딩 (3/20 ~ 3/24) (0) | 2021.03.24 |