피드로 돌아가기
새로워지기·서른의 생활코딩

java _20120223

NS
normalstory
표지 이미지





Integer 클래스의 주요 메소드
        String toString() : 숫자를 문자로
 

        static int parseInt(String str) throws  

        NumberFormatException    //static->class.으로 접근
 

        static String toBinaryString(int num):문자를 바이너리(2,16,8진) 형태로 반환

             //(Binary/HexString/OctalString)
 

        static Integer valueOf(String str)
        throws NumberFormatException    //string-> int 형태로 cast

 

 

System 클래스
       클래스 변수 : in(키보트로부터 받는다) out(모니터로출력한다) err(오류출력)
 

       System.out.println()   // System:class이름 /out:static 객체함수   


       static void arraycopy  //배열 복사

       (Object source, int sourceStart, Object target, int size)


       static void exit(int exitcode)  -> 실행방법 : System.exit(0) 

               = 정상종료 (0 이외의 값=비정상종류)

               자바는 자동으로 사용하지 않는 메모리 소멸시키지만,
               그 시점을 앞당기기 위해 사용.(단, 바로 메모리가 삭제되는 것은 아님)

 

 

 

 

예외의 개요
      프로그램 실행 중에 발생하는 예기치 않은 사건. (실행 오류)

      보다 완전한 프로그램을 구성할 목적으로 예외처리를 한다.

 
    사용
           정수를 0으로 나누는 경우

           배열의 첨자가 음수 또는 범위를 벗어나는 경우

           부적절한 형 변환이 일어나는 경우
           입출력을 위한 파일이 없는 경우 등
 

    예외 처리에 관련된 기본 클래스
           Error : 프로그램 코드에 의해서 수습될 수 없는 심각한 오류
           Exception : 수습이 될 수 있는 미약한 오류
 

    자바는 예외를 객체로 취급

          자바 프로그램에서는 Error(X), RuntimeException 클래스의 하위 클래스
          들을 제외한 모든 예외를 처리하여야 한다
 

          일반적으로 Error, RuntimeException(X) 클래스(하위 클래스 포함)들과
          연관된 예외는 프로그램에서 처리하지 않는다
                   이유 : 예외를 처리하여 얻는 이득보다 
                   예외를 처리하기 위한 노력이 너무 크기 때문
  

          Error class의 하위 클래스만 프로그렘 개발자가 오류처리해줄 수 없다.

    

    Exception 클래스의 하위 클래스
          CloneNotSupportedException 객체의 복제가 지원되지 않는 상황에서의 복제 시도
          InterruptedException 스레드가 인터럽트 되었을 때  

          RuntimeException 실행시간 예외가 발생할 때
          ArithmeticException 0으로 나누는 등의 산술적인 예외 (연산오류)

          NegativeArraySizeException 배열의 크기를 지정할 때 음수의 사용

          IndexOutOfBoundException 배열이나 스트링의 범위를 벗어난 접근.

          NullPointerException null 객체의 메소드나 멤버 변수에 접근할 때 

               (참조변수가 객체를 갖지않고 null인상태인데 접근시도)
 

    예외를 처리하는 방법

          예외가 발생된 메소드 내에서 처리하는 방법(try, catch 절 사용)

          하나의 try안에 다양한catch 를 사용할 수있다.

          예외가 발생된 메소드를 호출한 메소드에게 예외의 처리를 넘겨주는 방법

          (throws 절 사용)

  
   인위적으로 예외를 발생 :예외를 발생시키기 위해 throw 문 사용

          throw 예외객체;
          throw new 예외객체타입(매개변수);

          public void c() throws 예외클래스[, 예외클래스, ….]  

               // c()함수안에서 오류가 있을때, + 있을 수 있음을 명시.

   
   사용자는 새로운 예외를 정의하여 사용할 수 있다

          "Exception 클래스로부터 상속"

          반드시, 생성자있어야하고,

          생성자 안에는 super(값)에 Exception에 전달할 값이 들어있어야 한다.

             (생성자는 class?,상속이 안되므로)

 

  • Open in Google Docs Viewer
  • Open link in new tab
  • Open link in new window
  • Open link in new incognito window
  • Download file
  • Copy link address
  • Edit PDF File on PDFescape.com
  • Open in Google Docs Viewer
  • Open link in new tab
  • Open link in new window
  • Open link in new incognito window
  • Download file
  • Copy link address
  • Edit PDF File on PDFescape.com

element

Font
font-family
font-size
font-style
font-variant
font-weight
letter-spacing
line-height
text-decoration
text-align
text-indent
text-transform
white-space
word-spacing
color
Background
bg-attachment
bg-color
bg-image
bg-position
bg-repeat
Box
width
height
border-top
border-right
border-bottom
border-left
margin
padding
max-height
min-height
max-width
min-width
outline-color
outline-style
outline-width
Positioning
position
top
bottom
right
left
float
display
clear
z-index
List
list-style-image
list-style-type
list-style-position
Table
vertical-align
border-collapse
border-spacing
caption-side
empty-cells
table-layout
Effects
text-shadow
-webkit-box-shadow
border-radius
Other
overflow
cursor
visibility

    element

    Font
    font-family
    font-size
    font-style
    font-variant
    font-weight
    letter-spacing
    line-height
    text-decoration
    text-align
    text-indent
    text-transform
    white-space
    word-spacing
    color
    Background
    bg-attachment
    bg-color
    bg-image
    bg-position
    bg-repeat
    Box
    width
    height
    border-top
    border-right
    border-bottom
    border-left
    margin
    padding
    max-height
    min-height
    max-width
    min-width
    outline-color
    outline-style
    outline-width
    Positioning
    position
    top
    bottom
    right
    left
    float
    display
    clear
    z-index
    List
    list-style-image
    list-style-type
    list-style-position
    Table
    vertical-align
    border-collapse
    border-spacing
    caption-side
    empty-cells
    table-layout
    Effects
    text-shadow
    -webkit-box-shadow
    border-radius
    Other
    overflow
    cursor
    visibility
    친절한 찰쓰씨
    글쓴이
    친절한 찰쓰씨
    친절한 찰쓰씨 · 일상 UX 디자이너
    기획·디자인·단상을 조용히 기록합니다.
    작가 페이지에서 더 보기

    이어서 읽기

    새로워지기

    꾸준히, 오래, 지치지 않고

    Mar 31, 2026·8
    새로워지기

    테크 라이프 발란스

    Feb 7, 2026·3
    새로워지기

    휴탈리티 박정렬

    Feb 7, 2026·11