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 이란?인간이 이해하기 쉽게 하려고 만든 소스코드를 다시 기계..
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..
- Total
- Today
- Yesterday
- string class in java
- compareTo()
- easy javascript algorithm
- 프로그래머스 알고리즘문제
- substring()
- spring boot application
- hackerrank solution
- 프로그래머스 알고리즘
- math.max
- java
- hackerrank javascript solution
- math.abs
- 프로그래머스
- Object type casting
- 알고리즘
- Collection Framework
- ... in Javascript
- code refactoring
- algorithm
- Javascript Algorithm
- C++
- hackerrank javascript
- repeat()
- HackerRank Algorithm
- easy algorithm
- javascript
- hackerrank
- HashMap
- equals()
- rest parameter
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |