Getter and Setter 예시 1 class Member4 { int i; String name; String account; String passwd; private int birthyear; void setBirthyear(int birthyear) { if(birthyear < 0) { return; } this.birthyear = birthyear; } int getBirthyear() { return birthyear; } } 예시 2 public class Time { private int hour; private int minute; private float second; // Getter public int getHour() { return hour; } public int get..
Continue continue문은 반복문 내에서 사용될 수 있다. break는 그 조건에 충족하면 loop를 탈출하라는 의미이지만, continue는 반대로 조건에 충족하면 다시 loop를 돌라는 의미이다. 이미 반복문을 쓴 상황에서는 loop가 되는데 왜 다시 loop를 돌게 하는 continue 구문이 필요한지 의문스러울 수 있지만, continue는 조건을 충족하면 그 밑의 코드는 수행하지 않고 다시 loop를 돈다. Scanner sc = new Scanner(System.in); int i; while(true) { i = sc.nextInt(); if(i > 0) { System.out.println("Loop!"); continue; // 만약 입력된 값이 양수일 경우 "Loop 종료"를 ..
Today I Learned JAVA 객체지향언어 특징 메서드 알고리즘 13문제(프로그래머스 js level1)
객체지향언어 객체지향언어의 특징 코드의 재사용성이 높다.(기존의 코드를 이용하여 새로운 코드를 작성) 코드의 관리가 용이하다. (코드의 관계를 이용하여 쉽게 코드를 변경) 신뢰성이 높은 프로그래밍이 가능하다.(제어자와 메서드를 사용해 데이터를 보호, 코드의 중복을 제거) 클래스와 객체 클래스: 객체를 정의해 놓은 것. 객체를 만들기 위한 설계도 같은 것. JDK(Java Development Kit)는 유용한 클래스(JAVA API)를 기본적으로 제공한다. 인스턴스: 클래스로부터 객체를 만드는 과정을 클래스의 인스턴스화(instantiate)라고 하며 클래스로부터 만들어진 객체를 클래스의 인스턴스(instance)라고 한다. 인스턴스의 생성 Tv t; // 클래스명 변수명; t = new Tv(); //..
Node File System Module readFile, readFileSync const fs = require('fs'); // file system fs.readFile('./hello.txt', (err, data) => { if(err) { console.log('errrrrrorr'); } console.log('1', data.toString('utf8')); // print second }) const file = fs.readFileSync('./hello.txt'); console.log('2', file.toString()); // print first readFile이 더 윗줄에 있지만 readFileSync보다 늦게 로그된다. 왜냐하면 readFile은 asyncronous이고..
Express.js const express = require('express'); const app = express(); app.get('/', (req, res) => { res.send("getting root"); }) app.get('/profile', (req, res) => { res.send("getting profile"); }) app.post('/profile', (req, res) => { const user = { name: "Sally", hobby: "soccer" } res.send(user) }) app.listen(3000); // port express는 한줄 한줄 읽어서 시행한다. 첫 번째 요청의 경우 get method를 사용하여 그 url을 요청할 경우 {} 안의..
- Total
- Today
- Yesterday
- JavaScript
- package.json
- c언어
- jQuery
- react
- oracle
- this
- 인스턴스
- 포인터 변수
- Prefix Sums
- rxjs
- 제네릭스
- 개발 공부
- Data Structure
- Java
- useEffect
- getter
- CSS
- Conflict
- GIT
- 리덕스
- SQL
- Redux
- Session
- linkedlist
- 알고리즘
- youtube data api
- 깃
- til
- 자바
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |