Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 카카오 소셜로그인
- nodemailer
- 위크셋
- MongoDB
- 자바스크립트
- JavaScript
- nestjs
- JSON.parse
- 위크맵
- TypeScript
- Map
- DB
- 캐러셀
- 이메일 전송
- react-slick
- logstash
- 참조에 의한 객체 복사
- 구조 분해 할당
- Mongoose
- 객체
- AGGREGATE
- JSON.stringify
- 카카오로그인
- nest
- context switch
- nextjs
- 중첩 구조 분해
- javacript
- 로그스태시
- 화살표 함수
Archives
- Today
- Total
뚜sh뚜sh
데이터와 연산자 본문
상수
- 사용하고 있는 모든 수, 불변의 값
- 숫자 상수(정수형 상수, 부동소수점형 상수)와 문자 상수("a", "B", 유니코드 등)
package first;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.printf("%1$d %2$d",(int)'3', (int)'A');
}
}
// 51 65 (유니코드)
데이터형
- 기본형 : boolean, char, byte, short, int, long, float
- 참조형(reference type)
- 메모리 주소를 저장하는 데이터형(type) -> 클래스, 배열, 인터페이스
- 4 bype 크기
변수
- 상수를 저장하는 메모리 공간
- 형식 -> C언어와 동일(데이터형 변수명;)
package first;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
boolean bVar = true;
int nVar = 12;
float fVar = 3.14f;
char cVar = 'j';
System.out.println("bool형 : " + bVar + " 정수형 : " + nVar);
System.out.println("부동소수점형 : " + fVar + " 문자상수 : " + cVar);
}
}
연산자
- 산술 연산, 비교 연산 등에 사용되는 키워드 -> C언어와 동일
package first;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
int nVar1, nVar2, nResult;
nVar1 = 5;
nVar2 = 6;
nResult = nVar1 + nVar2;
System.out.println(nResult);
System.out.println(12 > 4);
System.out.println(12 == 4);
System.out.println((12 > 4) && (12 == 4));
}
}
Comments