일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- MIPS
- CSS
- Rag
- php
- instruction
- Pipelining
- github
- DS
- XML
- react
- openai
- architecture
- DATAPATH
- Class
- html
- control
- data structure
- computer
- Linux
- DB
- for
- Java
- Algorithm
- mysql
- system
- web
- python
- javascript
- AI
- function
- Today
- Total
목록Java (58)
YYYEJI

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문은 조건문에 따라 결과가 ..

Scanner class란? User에게 값을 입력받는 클래스입니다. ↓↓↓ Scanner class의 method를 하나씩 살펴보겠습니다 ↓↓↓ 우선 Scanner class를 사용할 때는 아래 패키지를 import 해야 됩니다. import java.util.Scanner; 패키지를 improt해준 이후에는 object를 생성해줍니다. public static void main(String[] args) { Scanner scan = new Scanner(System.in); } ① next() & nextLine() public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s1 = scan.next()..

변수(variable)이란? 변수는 변하는 수의 의미를 가지고 있습니다. 즉 데이터(data)를 저장할 수 있는 메모리 공간을 의미하는데 저장된 값이 변할 수 있습니다. 자바에서 변수명을 지을 때에는 아래와 같이 짓습니다. • 의미있게 변수명 짓기 • 글자와 숫자만 사용하기 • 2개 이상의 단어를 사용할 땐 대문자를 중간에 끼어넣기 (punctuate) • 변수명의 첫 문자는 lower case(소문자)로 시작하기 Ex) helloWord • Class의 첫 문자는 upper case(대문자)로 시작하기 Ex)World • Constant value에는 uppder case를 모두 사용하기 Ex) PI = 3.14159 .. 변하지 않는 상수(constant value)를 정의할 때는 아래와 같이 정의합..

이 에러는 앞서 실행한 파일과 충돌이 일어나서 생기는 에러인데 . . . 저는 이클립스를 방금 다시 다운받고 실행시킨 사람으로써 조금 당황을 했습니다. ↓↓↓ Error ↓↓↓ The selection cannot be launched, and there are no recent launches. 아래 스텝을 따라가주세요. ◡̈

자바에서 주석 처리하는 방법에 대해서 알아봅시다. public static void main(String[] args) { System.out.print("Hi~ "); System.out.print("there."); } 여기서 두번째 print문을 주석 처리를 하게 되면 public static void main(String[] args) { System.out.print("Hi~ "); // System.out.print("there."); } 두 번째 문자는 출력되지 않습니다. 한 번에 여러 줄을 주석 처리하는 방법을 알아보겠습니다. public static void main(String[] args) { System.out.print("Hi~ "); System.out.print("there.\..

Delimiter은 특정 문자열로 문자를 구분해줍니다. 아래 예제를 통해 public static void main(String[] args) { Scanner s = new Scanner ("2022/10/23"); s.useDelimiter("/"); while(s.hasNext()){ System.out.println(s.next()); } } 코드 한 줄씩 설명해 드리겠습니다. Scanner s = new Scanner ("2022/10/23"); ✓ 현재 s 객체에 "2022/10/23"이 들어가 있습니다. s.useDelimiter("/"); ✓ s 객체를 "/" 기준으로 문자열을 나눕니다. while(s.hasNext()){ System.out.println(s.next()); } ✓ s객체..

사용자로부터 값을 입력받기 위해서는 Scanner 함수를 사용해야 됩니다. import java.util.Scanner; 을 먼저 선언해주고 시작하겠습니다. 먼저 객체를 만들어줘야 합니다. Scanner s = new Scanner(System.in); 객체를 만든 후에 Scanner 관련 method를 사용할 수 있습니다. int i= s.nextInt(); double d= s.nextDouble(); Boolean b = s.nextBlooean(); String sentence= s.nextLine(); 예제를 살펴보겠습니다. ① nextInt public static void main(String[] args) { Scanner s = new Scanner (System.in); int n1 =..

Console 화면에 출력하는 코드는 아래와 같습니다. public static void main(String[] args) { System.out.print("Hello! "); System.out.println("There"); System.out.print("Welcome to My Blog !"); } 위에 코드에서 print, println이 쓰였습니다. 둘의 차이점은 무엇일까요? print는 결과 출력 후 줄바꿈을 하지 않지만 println은 출력 후 줄바꿈을 해줍니다. ◡̈