String
[Java Study] 문자열 replace 함수
public class main { public static void main(String[] args) { System.out.println("Hello World".length()); System.out.println("Hello, [[choi]]... bye.".replace("[[choi]]", "kim")); } } 11 Hello, kim... bye 문자열로 표현할 때 사용할 수 있는 length 함수와 replace 함수에 대하여 실습을 진행 해 보았다. C언어는 이런 함수들이 특정 헤더에 들어있어 사용이 필요할 때마다 찾아봐야 하는 번거로움이 있었지만 자바는 기본적으로 제공되는 다양한 함수들이 있는 듯 했다.
[Java Study] 문자열의 표현
public class main { public static void main(String[] args) { //String, Character System.out.println("Hello, world!"); //String 문자열 Character들의 집합체 System.out.println('H'); //Character 문자 하나 System.out.println("H"); System.out.println("Hello" +"world!"); System.out.println("Hello \nworld"); //New line System.out.println("Hello \"world\""); //Hello "world" } } Hello, world! H H Helloworld! Hello w..