본문 바로가기
개발일기

학원 수업 3일차 220822

by hhana 2022. 9. 13.
  • 9-10

java datatypes


char 2바이트(C언어에서는 1바이트) 0~65,535
ㄴ short와 65,536개 value 수는 같지만 범위가 다름

ㄴshort는 -32,768~32,767


boolean

 

소수 10진수 -> 2진수로 변환

https://m.blog.naver.com/winzone/70175202044

무릎을 탁 치게 해주는 설명!


0.5 *2 = 1 이므로 0.1 (2)
0.25 *2 = 0.5 , 0.5 *2 = 1 이므로 0.01 (2)

 

Q. 0.2를 2진수로 변환?
A. 
0.2*2 = 0.4 ...... 0
0.4*2 = 0.8 ...... 0
0.8*2 = 1.6 ...... 1
0.6*2 = 1.2 ...... 1
0.2*2 = 0.4 ...... 0
0.4*2 = 0.8 ...... 0
.
.
.

무한 반복 0.0011001100110011...

 

이게 무슨 말인지 모르겠다면? >>

2022.09.15 - [기본상식] - 10진수 십진수를 2진수 이진수로 바꿔보자! (+소수점을 포함한 수)

 

  • 10-11

이진수 부동소수점

 

위키백과 부동소수점 참고
https://ko.wikipedia.org/wiki/%EB%B6%80%EB%8F%99%EC%86%8C%EC%88%98%EC%A0%90

 

Q. -118.625를 2진수로 변환
A.
소수점 앞 정수부분 118 = 1110110

0.625 = 6.25 * 10^-1

0.625*2 = 1.25 -> 1
0.25*2 = 0.5 -> 0
0.5*2 = 1.0 -> 1

1110110.101

부동소수점까지는 이해 못하겠다; 소수를 이진수로 바꾸는 것까지만 일단 이해 완료;

 

  • 11-12

float, double 유형은 통화와 같은 정확한 값에 사용되지 않음.

자투리값 생김(float 6, double15 정밀도)


BigDecimal

 : Java 언어에서 숫자를 정밀하게 저장하고 표현할 수 있는 유일한 방법
https://jsonobject.tistory.com/466


Java Literals

https://www.tutorialspoint.com/java/java_basic_datatypes.htm

Java language supports few special escape sequences for String and char literals as well. They are −
Notation Character represented

\n Newline (0x0a)
\r  Carriage return (0x0d)
\f Formfeed (0x0c)
\b Backspace (0x08)
\s Space (0x20)
\t tab
\" Double quote
\' Single quote
\\ backslash
\ddd Octal character (ddd)
\uxxxx Hexadecimal UNICODE character (xxxx)

 

 

  • 12-1

Java - Basic Operators

https://www.tutorialspoint.com/java/java_basic_operators.htm

 

package


camel표기법


The Arithmetic Operators (A=10, B=20)

Operator Description Example
+ (Addition) Adds values on either side of the operator. A + B will give 30
- (Subtraction) Subtracts right-hand operand from left-hand operand. A - B will give -10
* (Multiplication) Multiplies values on either side of the operator. A * B will give 200
/ (Division) Divides left-hand operand by right-hand operand. B / A will give 2
% (Modulus) Divides left-hand operand by right-hand operand and returns remainder. B % A will give 0
++ (Increment) Increases the value of operand by 1. B++ gives 21
-- (Decrement) Decreases the value of operand by 1. B-- gives 19

 

 

  • 2-4

Operators

- Arithmetic
- Relational
- Logical
- Bitwise

 

  • 4-5

변수란?

값을 담을 수 있는 바구니

2장 변수와 타입 복습
7번 문제까지 연습
8번은 if문이 있어서 제외

'개발일기' 카테고리의 다른 글

학원 수업 9일차 220830  (1) 2022.09.30
학원 수업 8일차 220829  (0) 2022.09.16
학원 수업 7일차 220826  (0) 2022.09.16
학원 수업 6일차 220825  (0) 2022.09.16
학원 수업 5일차 220824  (1) 2022.09.16
학원 수업 4일차 220823  (2) 2022.09.13
학원 수업 2일차 220819  (0) 2022.08.29
학원 수업 1일차 220818  (0) 2022.08.23

댓글