연

  • 홈
  • 태그
  • 방명록

메서드 2

제네릭 메서드 예제 (태그 설명)

package sec04_exam02_generic_method; public class Pair { private K key; private V value; public Pair(K key, V value) { this.key = key; this.value = value; } public void setKey(K key) { this.key = key; } public void setValue(V value) {this.value = value; } public K getKey() { return key; } public V getValue() { return value; } } package sec04_exam02_generic_method; public class Utill { //제너릭 메소드 ..

JAVA 2022.09.29

객체지향 static 메서드와 instance 메서드

class Math2{ long a, b; long add() { //인스턴스 메서드 return a+b; } static long add(long, longb) { //클래스 메서드(static 메서드) return a + b; } } 호출 class Math2{ public static void main(String arg[]){ System.out.println(Math2.add(200L,100L); 클래스메서드 호출 '클래스이름.메서드' Math2 mm = new Math2(); // 인스턴스 생성 (iv 생성) mm.a = 200L; mm.b = 100L; System.out.printl(mm.add()); //인스턴스 메서드 호출 (iv로 작업) 인스턴스 메서드 인스턴스 생성 후 '참조변수.메..

JAVA 2022.09.25
이전
1
다음
더보기
프로필사진

연

  • 분류 전체보기 (121)
    • HTML (2)
    • 기초 지식 정리 (6)
    • JavaScript (18)
    • JAVA (66)
    • Spring (3)
    • Data base (21)

Tag

단일상속, 메서드, 객체지향, 객체지향개념, 생성자, 형변환, 컬렉션 프레임웍, 기본 생성자, 자바의정석, 상속, static, 다형성, 변수의 초기화, 참조변수, 매개변수, super, constructor, default, 매개변수의 다형성, 추상 메서드,

최근글과 인기글

  • 최근글
  • 인기글

최근댓글

공지사항

  • 개인 공부 정리 블로그입니다.

페이스북 트위터 플러그인

  • Facebook
  • Twitter

Archives

Calendar

«   2025/05   »
일 월 화 수 목 금 토
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

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바