if문if문은 조건식이 참이면 내부 블록을 실행하고, 거짓이면 내부 블록을 실행하지 않습니다.if(조건식){ 실행문;}public class ConditionalExam { public static void main(String[] argv) { int value = 3; if( value % 3 == 0 ) { System.out.println("value는 3의 배수입니다."); } }}// 출력 : value는 3의 배수입니다. if else문을 사용하면 다중 조건에 대해 더 쉽게 조건문을 작성할 수 있습니다.※ if else문은 무한정 사용 가능합니다. 다만, else if를 너무 많이 쓰는 코드는 속도가 느리..
산술 연산자// i와 j의 합i + j;// i와 j의 차i - j;// i와 j의 곱i * j;// i를 j로 나눈 몫i / j;// i를 j로 나눈 나머지i % j; 비교 연산자비교 연산을 할 때 ==, !=, , = 기호를 사용합니다.비교 연산을 사용하면 boolean형 변수로 값이 산출됩니다.주의할 점!! '='는 항상 뒤에 있어야 합니다!! >= (o) | => (x) int i = 10; int j = 10; // i와 j가 같은지 비교하는 연산자 System.out.println(i == j ); // true // i와 j가 다른지 비교하는 연산자 System.out.println(i != j ); // false // i가 j보다 작..
JAVA에서의 기본적인 구조class의 이름 앞 글자는 무조건 대문자로 생성합니다. public class Main { public static void main(String[] args) { System.out.println("Hello World"); // 출력문 }} 주석한 줄만 주석 처리 : // 주석 처리할 내용여러 줄을 주석 처리 : /* 주석 내용 */문서화 주석 : /** 주석 내용 */public class HeloWorld{ public static void main(String[] args){ System.out.println("HelloWorld"); // 한 줄만 주석 처리합니다. // System.out.prin..
- Total
- Today
- Yesterday
- db
- Security
- 디자인패턴
- Algorithm
- Spring Security
- programmers
- Annotation
- brute-force
- Java
- 생활코딩
- 백준
- Kotlin
- Greedy
- Effective Java
- Spring
- Spring Boot
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |