✨
Java
  • 자바의 역사
  • Ch1
    • Before Start Java
      • History of Java
      • Feature of Java
      • API Documentation
      • Hello World!
      • eclipse shortcut
      • Eclipse IDE
      • GitHub to eclipse
  • Ch2
    • Variable
      • Variable
    • Variable Type
    • Character and String
    • Primitive type and range
    • printf and formatter
    • Scanner
    • Overflow of Int
    • Transition between different variable types
    • Object Array
  • CH3
    • Operator
  • CH4
    • 조건문과 반복문
    • if statement
    • switch
    • Math.random()
    • for statement
    • while statement
    • break, continue, named iterated statement
  • CH5
    • Array
    • 배열 활용
    • String Array
  • OOP
    • Intro
  • Class and Object
  • Make multiple Classes in one file
  • How to use Object
  • Object Array
  • Variable type according to declared location
  • Class Variable and Instance Variable
  • Method
  • Call Stack
  • Parameter
  • Static method(Class method) and Instance method
  • (Method)Overloading
  • Constructor
  • Constructor this()
  • Reference type variable "this"
  • Initialize variable
  • Inheritance
  • Composite
  • Single Inheritance, Object Class
  • (Method)Overriding
  • super, super()
  • package, class path
  • import, static import
  • modifier
  • access modifier
  • Encapsulation
  • Polymorphism
  • reference type transition
  • instanceof operator
  • Parameter polymorphism
  • Multiple object using one array
  • Abstract Class, Abstract Method
  • Creating Abstract Class
  • Interface
  • Interface Polymorphism
  • Interface Pros
  • Default method and static method
  • Inner Class
  • Anonymous Class
  • java.lang package and useful class
    • Object class
    • hashCode(), toString()
    • String class
    • StringBuffer class
    • StringBuilder class
    • Math class
    • Wrapper class
    • Number class
    • String to Number, String to Wrapper class
    • Auto-boxing and (auto)Unboxing
  • Collection Framework
    • Collections framework
    • List, Set, Map Interface
    • List의 removeAll() 과 clear() 비교
    • List Interface - ArrayList
    • How to view Java API source
    • List Interface - LinkedList
    • Stack and Queue
    • Iterator, ListIterator, Enumeration
    • Array
    • Comparator와 Comparable
    • Stack
    • String
    • String + char = String
    • String.toCharArray()
    • BufferedReader / BufferWriter
    • Scanner로 String 입력 - next( )와 nextLine( )
    • 공백없이 2차원배열 데이터 String으로 한번에 한줄씩 입력받기(문자/숫자)
    • 공백을 사이에 두고 빠른 2차원 배열 입출력
    • arr[index++]과 arr[index] index++의 차이
    • int와 long의 차이
    • Untitled
    • 타입 간의 변환
    • Array 와 ArrayList
    • valueOf()
    • Char
    • 변수, 객체 초기화(초기값 설정)
  • error troubleshooting
    • No enclosing instance of type
    • ASCII Code Table
    • java.lang.NumberFormatException
    • No enclosing instance..
  • reference
    • String을 생성하는 2가지 방법과 차이점
    • StackOverflowError(스택, 힙 메모리)
    • swtich-case 반복문
Powered by GitBook
On this page

Was this helpful?

  1. java.lang package and useful class

Wrapper class

- The class wraps primitive type. - When handle 8 types of primitive type as object. =>why? OOP is Object-Oriented Programming. It needs to be as Object. 90% is Object and remains are primitive type because of performance.

public final class Integer extends Number implements Comparable {
    ...
    private int value;//wraps int type.
}

primitive type

wrapper class

constructor

example

boolean

Boolean

Boolean(boolean value)

Boolean(String s)

Boolean b = new Boolean(true);

Boolean b2 = new Boolean("true");

char

Character

Character(char value)

Character c = new Character('a');

byte

Byte

Byte(byte value)

Byte(String s)

Byte b = new Byte(10);

Byte b2 = newByte("10");

short

Short

Short(short value)

Short(String s)

Short s = new Short(10);

Short s2 = new Short("10");

int

Integer

Integer(int value)

Integer(String s)

Integer i = new Integer(100);

Integer i2 = new Integer("100");

long

Long

Long(long value)

Long(String s)

Long l = new Long(100);

Long l2 = new Long("100");

float

Float

Float(double value)

Float(float value)

Float(String s)

Float f = new Float(1.0); Float f = new Float(1.0f); Float f = new Float("1.0f");

double

Double

Double(double value)

Double(String s)

Double d = new Double(1.0);

Double d = new Double("1.0");

Integer i = new Integer(100);//address : 0x100
Integer i2 = new Integer(100);//address : 0x200

System.out.prinln("i==i2?" + (i==i2));//false.0x100!=0x200
System.out.prinln("i.equals(i2)?" + i.equals(i2));//true.means overriding.
//오른쪽 값이 더 작으면 양수,오른쪽 값이 더 크면 음수, 같으면 0
System.out.prinln("i.compareTo(i2) ="+i.compareTo(i2)); 
System.out.prinln("i.toString()="+i.toString());

PreviousMath classNextNumber class

Last updated 4 years ago

Was this helpful?