카테고리 없음

221205

Berylly 2022. 12. 5. 18:46

T. 김동식 + 서치보완

 

.exe:  Executable(실행파일)의 앞 3글자를 따온 것

console: 입출력장치

syso ctrl + spacebar = System.out.println(); 이클립스 단축키

System.out.println(); 줄바꿈하여 출력하라

nul: 0, 비어있음

ID: identify document

 

프로젝트 > 패키지 > 클래스

src 자바소스 파일이 위치

bin class 파일이 위치

var: variable 변수, 가변적인 ( <-> constant 상수, 일정한)

asterisk: 저장되지않았다.

 

 

데이터타입

데이터타입은 정수(int)와 문자 또는 문자열 이런 세가지가 가장 많이 선언됨

정수형 : byte, short, int, long
실수형 : float, double
문자형 : char
논리형 : boolean

*bsil한fd가cb를 거네 12484821로 암기하자.

float var2=3.14f;
long var4 = 2147483645555L;

자바에서 정수의 기본값이 int, 정수의 기본값이 double.

다른타입일 경우 끝에 f, L등을 붙여 컴퓨터에게 알려준다.

*f는 소문자,  L은 대문자가 관례이다.

 

 

 

변수

변수선언: 메모리에 방(변수명)을 선언한다.

문자(character)는 홑따옴표로, 문자열은 쌍따옴표로 감싼다.

https://sanghee.tistory.com/11

 

명명법 (Casing)

카멜 표기법 camelCase 파스칼 표기법 CamelCase 스네이크 표기법 snake_case 마크로 표기법 MACRO Kebob 표기법 ke-ba-b Plain 캐이싱 plain 외에도 많다. 위는 대표적인 케이싱방법.

sanghee.tistory.com

 

ASCII코드

'char = 숫자' 는 ASCII코드를 통해서 문자와 호환된다.

A = 65(ASCII코드)
a = 97(ASCII코드) 


*ASCII (American Standard Code for Information Interchange, 미국 정보 교환 표준 부호): 미국 ANSI에서 표준화한 정보교환용 7비트 부호체계

https://www.asciitable.com

 

ASCII Table - ASCII Character Codes, HTML, Octal, Hex, Decimal

ASCII Table ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as 'a' or '@' or an action of some sort. ASCII was developed a long

www.asciitable.com

 

Python

>>> age=22
>>> age
22
>>> print(age)
22

>>> var1='a'
>>> var1
'a'
>>> print(var1)
a

첫번째 방법은 값을 그저 '확인'하는것이고, print는 출력하는 것.
숫자로 출력했을때는 결과값이 같으나 실직적인 뜻은 다름을 이해한다.

 

>>> type(age)
<class 'int'>

>>> type(var1)
<class 'str'>

type() 파이썬에서 데이터타입을 알아보는 명령

 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'var2' is not defined. Did you mean: 'var1'?

추적(가장 최근의 통화 마지막):
  파일 "<stdin>", 라인 1, <모듈>
이름 오류: 'var2' 이름이 정의되지 않았습니다. 'var1'을 말하는 건가요?

= 키보드에서 입력한 첫번째줄에 변수이름을 정의를 하지않은 오류가 있다.

 

>>> 2/3
0.6666666666666666
>>> 2//3
0
>>>

//: 소수점 아래를 날린다.

 

>>> 3%2
1

%: 나머지를 구한다.

 

>>> 2**3
8

**: 지수, 거듭제곱

 

>>> 2**(1/2)
1.4142135623730951

√2 (엑셀에서는 sqrt(2)) = 2^(1/2) = 2**(1/2)

 

>>> bin(79)
'0b1001111'

2진수

 

>>> oct(79)
'0o117'

8진수

 

>>> hex(79)
'0x4f'

16진수

 

>>> true
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'true' is not defined. Did you mean: 'True'?
>>> False
False
>>> false
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'false' is not defined. Did you mean: 'False'?

>>> True
True
>>> False
False

True와 Flase는 대소문자를 구별한다.

 

>>> bool(1)
True
>>> bool(0.555)
True

>>> bool(0)
False

>>> bool(-0.55)
True
>>> bool(-1)
True

0을 제외한 나머지는 참.

 

>>> 1==1
True

==: 비교해본다

 

>>> True and True
True
>>> False and False
False
>>> True and False
False
>>> False and True
False
>>> True or True
True
>>> True or False
True
>>> False or True
True

논리연산(and, or)

and에서 True는 모두 참인것, False는 하나라도 거짓인것으로, 

or에서 True는 하나라도 참인것으로 간단히 이해한다.