일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Java
- DoM
- DS
- Pipelining
- Class
- data structure
- CSS
- mysql
- MacOS
- DATAPATH
- instruction
- react
- javascript
- python
- while
- architecture
- Linux
- function
- php
- html
- web
- MIPS
- DB
- Algorithm
- for
- computer
- system
- github
- control
- XML
- Today
- Total
YYYEJI
[JAVA] Flow of Control 본문
Flow of Control이란?
Program의 instruction이 실행되는 순서입니다.
(Instruction - machine language에서의 코드 한 줄을 의미)
① Sequence
다음 instruction(code)로 그냥 넘어갑니다.
Program의 defualt 값 입니다.
② Branching or Selection
두 선택지 중에 하나를 선택하게 됩니다.
- 다음 instruction(code)로 넘어갈지,
- 다른 instruction으로 jump할지
선택합니다.
Ex) if, if-else, switch etc.
https://yyyeji.tistory.com/323
[JAVA] If 문이란?
If문이란? If의 뜻은 '만약에'입니다. 이처럼 if문은 조건문에 따라 결과가 다르게 작동합니다. ① If문 if(Boolean_Expression) Action; // execute only if true public static void main(String[] args) { int num = 10; if(num == 10
yyyeji.tistory.com
https://yyyeji.tistory.com/325
[JAVA] Switch 문이란?
Swith문이란? 변수 값과 일치하는 case 값이 실행되는 조건 판단문입니다. 예제를 살펴보겠습니다. switch (variable) { case something1 : action1 break; case something2 : action2 break; case something3 : action3 break; default :
yyyeji.tistory.com
③ Loop or Repetition
Block을 반복하는데 이 경우에도 선택지는 두 개입니다.
- Code의 block을 반복할지,
- block이 끝난 후 다음 instruction으로 넘어가서 코드를 계속 수행할지
선택합니다.
Ex) while, do-while, for
https://yyyeji.tistory.com/328
[JAVA] While문이란?
while문이란? 반복 횟수가 아닌 조건문으로 코드의 block을 반복시키고 싶을 때 사용하며, Sentinel-controlled loop 또는 counting loop라고도 불립니다. while (Boolean_Expression) { Action_code; } public static void main(Str
yyyeji.tistory.com
https://yyyeji.tistory.com/329
[JAVA] do-while문이란?
do-while문이란? while문과 동일한데 do-while문은 조건이 true이든 false이든 최소한 한 번은 실행하고 조건문을 확인합니다. do { Action_code; } while (Boolean_Expression) public static void main(String[] args) { String month
yyyeji.tistory.com
https://yyyeji.tistory.com/326
[JAVA] for문이란?
for문이란? for문은 어떠한 행위를 반복하면서, 반복되는 횟수를 제어하고 싶을 때 사용하며, Counting loop 라고도 불립니다. for(i = 0; i
yyyeji.tistory.com
◡̈
'Java' 카테고리의 다른 글
[JAVA] 조건부 연산자(Conditional operator) (0) | 2022.12.24 |
---|---|
[JAVA] If 문이란? (0) | 2022.12.24 |
[JAVA] Scanner 클래스 (0) | 2022.12.24 |
[JAVA] 변수(variable)란? (0) | 2022.12.23 |
[JAVA] 이클립스 The selection cannot be launched, and there are no recent launches 오류 해결하기 (0) | 2022.11.03 |