전체
-
자바 기본 API - ArrayListJAVA 2023. 12. 11. 14:46
ArrayList란? 동적배열이라고 불리기도 한다. 코드상 저장데이터의 접근이 복잡하다 다양한 타입의 데이터를 n개 저장하여 관리하는 객체다. 객체가 추가되어 용량을 초과하면 자동으로 부족한 크기만큼 용량이 늘어난다(동적배열이라 불리는 이유) 동일한 n개의 참조형 데이터 또는 서로다른 n개의 참조형 데이터를 저장하여 관리한다 ArrayList객체에는 기본형 데이터 저장은 안된다 이론적으론 기본형 데이터가 저장이 불가능하나, 기본형 데이터를 관리하는 객체를 이용하면 저장이 가능하다. 자료형 객체명 byte Byte short Short int Integer long Long double Double float Float char Character boolean Boolean 형식 📌int 자료형 예시 Ar..
-
자바에서 기본 제공하는 API (배열)JAVA 2023. 12. 8. 16:11
API란? Application Programming Interface의 약자로 다른 프로그램이나 서비스에서 제공하는 기능을 외부에서 호출하여 사용할 수 있도록 만들어진 인터페이스. 예를 들어, 특정 웹사이트의 API를 이용하면 그 사이트가 제공하는 정보나 기능을 우리가 만든 다른 프로그램에서도 사용할 수 있다. API를 활용하면 우리가 필요한 정보나 기능을 쉽고 빠르게 가져와서 자신만의 창조적인 작업에 활용할 수 있음. 자바에서 동일한 성격의 다량의 데이터를 쉽게 관리하는법 배열객체 || ArrayList || HashMap 사용한다 ArrayList 객체는 ArrayList 클래스로 존재함. 배열객체는 따로 클래스로 존재하지 않는다. ArrayList 객체와 비슷한 기능의 객체가 많이 존재함. 배열 ..
-
인터페이스(interface)JAVA 2023. 12. 8. 15:36
public , final , static 성격을 가진 [멤버변수]와 public , abstract 성격을 가진 [메소드] 로만 구성된 단위프로그램이다. 즉 상수와 추상메소드로만 구성된 단위프로그램 선언 형식 public final static 자료형 멤버변수명 = 데이터; public abstract 리턴형 메소드명(); 💥생성자는 없다. 객체화 불가 메소드에 static 붙으면 안된다 멤버변수에는 수동초기화 해야한다. 상수는 수동초기화를 안할 수 없다. 인터페이스의 구현 클래스가 인터페이스의 추상메소드를 물려받아 바디를 붙여 재정의 하는 행위를 말한다. 이때 물려받은 모든 메소드를 재정의 하면 new에 의해 객체생성이 가능한 일반 클래스가 된다 허나, 물려받은 모든 메소드를 재정의 안하면 new에 ..
-
상속JAVA 2023. 12. 7. 22:51
상속 정의 예를들자면 [A클래스] 내부의 멤버(멤버변수,생성자,메소드)를 [B클래스][C클래스][D클래스][E클래스]~~~~[Z클래스]등등 안에서 객체화 없이 자기 멤버처럼 호출할수 있는 관계를 상속이라고 한다. ⭐ 상속관계가 아니라면 반드시 객체화 후 멤버를 호출해야 한다. 위 예시의 상속관계에선 A클래스를 슈퍼클래스라 부르고 B~ Z클래스를 서브클래스라고 부름. 상속관계 코딩형식 슈퍼클래스 형식 [public][abstract] class 슈퍼클래스명 {~} 서브클래스 형식 [public][abstract|final] class 서브클래스명1 extends 슈퍼클래스명{~} ⭐ 슈퍼클래스 선언시 final이 붙으면 절대 안된다 final이 붙으면 서브클래스가 상속할수 없다. 상속의 장점 1개의 슈퍼클..
-
클래스(Class)JAVA 2023. 12. 5. 18:45
java에서 최소단위 프로그램의 한 종류이다. 클래스 내부의 구성요소는 [멤버변수], [메소드], [생성자]이다. package 패키지명; import 수입클래스패키지명.수입클래스명; [public] [abstract|final] class 클래스명{ 멤버변수 생성자 메소드 등등 } 키워드명 의미 package 클래스의 소속 [묶음명]을 지정한다. 패키지란 서로 기능이 비슷하거나 관련이 있는 [클래스] 또는 [인터페이스] 들을 묶어 놓은 묶음이다. import 타 패키지 소속 클래스를 객체화하여 사용할 경우 수입할 패키지명과 클래스명을 지정한다. 0개 이상 선언할 수 있다. 같은 패키지에 있는 타 클래스와 java.lang 패키지 안의 모든 클래스는 수입 코딩 없이도 자동 수입된다. 수입클래스명 대신 *..