메소드

it/programming

[JAVA] 메소드와 생성자를 이용한 가상 DB 관리

import java.util.Scanner; class Product { String code, name; int price, discount; Product(String code, String name, int price, int discount) { this.code=code; this.name=name; this.price=price; this.discount=discount; } Product(String code, String name, int price) { this.code=code; this.name=name; this.price=price; this.discount=0; } void setDiscount(int discount){this.discount=discount;} int cal..

반응형
훈솔
'메소드' 태그의 글 목록