toStringsuperclass called Object class has toString() method which converts data(mostly numbers) to string.When System.out.printlf and System.out.print have reference to an object instead of actual string, they call toString method so, the toString method print the string. It describes the object. 객체가 가진 값을 문자열로 리턴하는 메서드. 객체를 리턴할 때 보여주고자 하는 방식으로 method를 오버라이드해서 보여줄 수 있다. 아래의 예시처럼 단순히 숫자만 불러오는 것이..
wrapper class the primitive data type is not an object, so If we need a method that only takes objects as a parameter, it can't be used. Therefore, wrapper classes are used to convert data type into an object. Primitive Data Type Wrapper instance char Character byte Byte short Short long Integer float Float double Double boolean Boolean Boxing & UnBoxing The conversion of primitive data types in..
Methods of String class substring()to get substring using substring(include index,exclude index); 12String i="java"; System.out.println(i.substring(1,2));//a cs length()to get the length of the string. 123String s="javastring"; System.out.println("string length is: "+s.length());//10 Colored by Color Scriptercs equals() equals() method compares two strings found on the content of the string. if ..
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..
- Total
- Today
- Yesterday
- equals()
- math.max
- Object type casting
- hackerrank solution
- HackerRank Algorithm
- 프로그래머스 알고리즘문제
- math.abs
- HashMap
- hackerrank javascript solution
- hackerrank
- repeat()
- C++
- rest parameter
- hackerrank javascript
- 프로그래머스 알고리즘
- Javascript Algorithm
- Collection Framework
- java
- javascript
- 알고리즘
- code refactoring
- compareTo()
- spring boot application
- algorithm
- ... in Javascript
- easy javascript algorithm
- easy algorithm
- 프로그래머스
- substring()
- string class in java
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |