예제 #1
0
 public void writeInfo(
     String Company, String name, String serialNo, String screenSize, String screenTrype) {
   super.writeInfo(Company, name, serialNo);
   // 부모에게 선언된 public 메소드에 접근, 사용 가능
   // 어떻게? super라는 키워드를 통해서...
   this.screenSize = screenSize;
   this.screenType = screenTrype;
 }
예제 #2
0
  public ProductSpec getNextProduct() {
    // read next line in file
    // then create a ProductSpec instance and return it
    // listOfItems.add(new Item(productSpec));
    String UPC = parsedSpec.substring(0, 3);
    String description = parsedSpec.substring(9, 28);
    String sPrice = parsedSpec.substring(34);
    float price = Integer.parseInt(sPrice);

    ProductSpec nextProduct = new ProductSpec();

    nextProduct.setUPC(UPC);
    nextProduct.setDescription(description);
    nextProduct.setPrice(price);

    return nextProduct;
  }
예제 #3
0
  @Override
  public void getInfo() {

    super.getInfo();

    System.out.println("cpu 정보 : " + this.cpu);
    System.out.println("메인메모리 정보 : " + this.ram);
    System.out.println("하드디스크 정보 : " + this.hdd);
  }
예제 #4
0
 public void setInfo(
     String company, String name, String serialNo, String cpu, String ram, String hdd) {
   // 파라미터로 넣어온  값들도 바로 super를 통해 부모 메소드의 파라미터로 던져서 바로 set 합니다
   // 즉 멤변의 공유가 부모자식 관계에서 성립하므로 부모의 멤변에 대한 접근 역시 가능해졌습니다.
   super.setInfo(company, name, serialNo);
   this.cpu = cpu;
   this.ram = ram;
   this.hdd = hdd;
 }
예제 #5
0
 @Override
 public void showInfo() {
   super.showInfo();
   System.out.println("스크린 사이즈 :" + this.screenSize);
   System.out.println("스크린 타입 :" + this.screenType);
 }