Why use Generics in Java? - Class를 정의할 때는 datatype을 정하지 않고, 인스턴스를 생성할 때 datatype을 지정하는 것이 Java Generic 이다.- Java Generics은 기본datatype 에서는 사용하지 않고 reference datatype(e.g. Arrays, Class, Interface etc) 에서만 사용가능하다.- Generic은 compile time error를 발견하게 도와준다. -> 프로그램상에서 런타임에러는 심각한 문제를 초래 할 수 있기 때문에 컴파일에러가 나도록 유도해야한다. *runtime error compile error 런타임에러와 컴파일 에러란? compile 이란?인간이 이해하기 쉽게 하려고 만든 소스코드를 다시 기계..
'@Bean' and '@Autowired' annotation in Spring Boot * Spring Boot 에서 bean 은 객체를 의미한다. 두 annotation 은 객체를 불러주기에 비슷해 보이지만 큰 차이가 있다. 바로 @Bean annotation은 Class 내에 객체를 먼저 '생성' 시키고 만들어진 객체를 부르는 반면 @Autowired annotation 은 이미 이전에 '만들어진' 객체를 불러오는 기능만은 담당하기 때문이다. 그래서 객체를 미리 생성하지 않고 @Autowired annotation을 사용한다면 앞서 만들어 놓은 객체가 없기 때문에 에러를 발생시킨다. '@Resource' and '@Autowired' @Autowire는 Bean을 불러올때 같은 type을 기준으로..
static 의 특징- Static method는 클래스의 특정 객체가 아닌 클래스 자체에 속해있다. - static은 class가 load될 때 단 한번 실행된다.- You can use a class name to call the static method.- To access "static" we don't need an object.static method는 instance 생성을 하지 않아도 접근 할 수가 있는 반면에 non-static method는 인스턴스 생성을 통해서만 접근 가능 하다. * 별도 메모리공간에 할당되어 초기화까지 완료가 된다. 그렇기에 인스턴스를 생성하지 않아도 호출이 가능 When do we use the Static method?- If the static method i..
Overloading in Java In Java, If two or more methods in a class have the same method name but different parameters, the methods are defined as different methods even though it has the same method name. simple example code12345678910111213141516171819202122232425262728293031323334class Calculator { int a, b, c; public void setCal(int a, int b){ this.a = a; this.b = b; } //same method name with dif..
The specialties of Overriding 1. @Override annotation needed. 2. The parameter(s) and return type must be the same as an inherited from its superclass. 3. Super keyword needs to refer to a parent class.4. Final methods, private methods and Static methods cannot be overridden.5. a method overriding can only be written in a subclass, not in the same class. Example Code 1234567891011121314151617181..
SuperA super keyword refers to a parent class. Attaching () with super keyword means the constructor of the parent class. This ensures that no errors occur even if the default constructor for the parent class is lost. Example Code I1234567891011121314151617181920212223242526272829303132333435class Calculator { int a, b; public Calculator(){} //하위클래스가 호출될 때 자동으로 부모클래스의 생성자가 호출 //매개변수가 없는 기본생성자가 없..
- Total
- Today
- Yesterday
- math.max
- compareTo()
- Object type casting
- substring()
- math.abs
- hackerrank javascript solution
- hackerrank solution
- 프로그래머스 알고리즘
- spring boot application
- java
- 알고리즘
- easy algorithm
- equals()
- HashMap
- 프로그래머스
- hackerrank
- code refactoring
- javascript
- 프로그래머스 알고리즘문제
- ... in Javascript
- C++
- algorithm
- HackerRank Algorithm
- Javascript Algorithm
- rest parameter
- Collection Framework
- easy javascript algorithm
- string class in java
- repeat()
- hackerrank javascript
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |