개요[ | ]
- 자바에서 변하지 않는 상수를 선언하여 코드의 유지보수를 쉽게 할수 있다
- 예를 들면 IP 주소 혹은 경로 등등
Java
CPU
1.2s
MEM
70M
0.8s
Copy
public class ConstantsTest{
public static final String ANSIBLE_IP = "127.0.0.1";
public static final String ANSIBLE_PORT = "2222";
public static void main(String[] args) throws Exception{
String ansibleIP= ANSIBLE_IP.toString();
String ansiblePort = ANSIBLE_PORT.toString();
System.out.println(ansibleIP);
System.out.println(ansiblePort);
}
}
127.0.0.1 2222
편집자 에어컨
로그인하시면 댓글을 쓸 수 있습니다.
- 분류 댓글:
- Java (3)
Java 튜토리얼 웹사이트 ― Thesmolt젠킨스 ― John Jeong젠킨스 ― Icesky