Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package tugasper8;
- /**
- *
- * @author Acer
- */
- public class TugasPer8 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // Buat objek dari class printAll
- new printAll();
- }
- }
- // Untuk menggunakan class interface,
- // pada class yang menggunakan interface harus menggunakan keyword implements
- class printAll implements shape {
- // Pendeklarasian method cetakAngka
- @Override
- public void getArea() {
- System.out.println("Diameter Circle"+diameterLingkaran);
- System.out.println("Panjang Shape"+luasLingkaran);
- }
- // Pendeklarasian method cetakHuruf
- @Override
- public void getName() {
- System.out.println("Nama "+circle);
- System.out.println("Nama "+square);
- }
- // konstruktor
- public printAll() {
- // Panggil method cetakAngka
- // Panggil method cetakHuruf
- getName();
- getArea();
- }
- }
Add Comment
Please, Sign In to add comment