rangga_hrdme

OOP-JAVA: CLASS

May 4th, 2021 (edited)
147
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // OOP: Class
  2. public class Laptop {
  3.  
  4.     private String Mark, Ram, ProceSsor, Graphic, Country;
  5.  
  6.     public static void main(String[] args) {
  7.         Laptop dell = new Laptop("indonesia", "dell vostro", "8gb", "i5", "nvidia");
  8.         Laptop hp = new Laptop("singapore", "hp pavilion", "12gb", "i3", "radeon");
  9.         Laptop asus = new Laptop("USA", "asus rog", "32gb", "i7", "intel hd");
  10.  
  11.         dell.origin();
  12.         hp.origin();
  13.         asus.mark();
  14.  
  15.         System.out.println(
  16.                 "Country: " + dell.Country
  17.                 + " Graphic Card: " + dell.Graphic
  18.                 + " Mark: " + dell.Mark
  19.                 + " Processor: " + dell.ProceSsor
  20.                 + " RAM: " + dell.Ram
  21.         );
  22.     }
  23.  
  24.     public Laptop(String country, String mark, String ram, String proceSsor, String graphic) {
  25.         this.Country = country;
  26.         this.Mark = mark;
  27.         this.Ram = ram;
  28.         this.ProceSsor = proceSsor;
  29.         this.Graphic = graphic;
  30.     }
  31.  
  32.     private void origin() {
  33.         System.out.println(this.Country + " Export Laptop");
  34.     }
  35.  
  36.     private void mark() {
  37.         System.out.println("Your mark: " + this.Mark);
  38.     }
  39. }
RAW Paste Data