Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Laptop {
- protected String mark, ram, proceSsor, graphic, country;
- public static void main(String[] args) {
- Laptop dell = new Laptop("indonesia", "dell vostro", "8gb", "i5", "nvidia");
- Laptop hp = new Laptop("singapore", "hp pavilion", "12gb", "i3", "radeon");
- Laptop asus = new Laptop("USA", "asus rog", "32gb", "i7", "intel hd");
- dell.printLaptop();
- hp.printLaptop();
- asus.printLaptop();
- }
- public Laptop(String country, String mark, String ram, String proceSsor, String graphic) {
- this.country = country;
- this.mark = mark;
- this.ram = ram;
- this.proceSsor = proceSsor;
- this.graphic = graphic;
- }
- public void printLaptop() {
- System.out.println(
- "Country: " + this.country
- + ", Graphic Card: " + this.graphic
- + ", Mark: " + this.mark
- + ", Processor: " + this.proceSsor
- + ", RAM: " + this.ram
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment