cybergraph

Main Class pertemuan 8

Nov 28th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package tugasper8;
  7.  
  8. /**
  9. *
  10. * @author Acer
  11. */
  12. public class TugasPer8 {
  13.  
  14. /**
  15. * @param args the command line arguments
  16. */
  17. public static void main(String[] args) {
  18. // Buat objek dari class printAll
  19. new printAll();
  20. }
  21.  
  22. }
  23.  
  24. // Untuk menggunakan class interface,
  25. // pada class yang menggunakan interface harus menggunakan keyword implements
  26. class printAll implements shape {
  27.  
  28. // Pendeklarasian method cetakAngka
  29. @Override
  30. public void getArea() {
  31.  
  32. System.out.println("Diameter Circle"+diameterLingkaran);
  33.  
  34. System.out.println("Panjang Shape"+luasLingkaran);
  35.  
  36. }
  37.  
  38. // Pendeklarasian method cetakHuruf
  39. @Override
  40. public void getName() {
  41. System.out.println("Nama "+circle);
  42. System.out.println("Nama "+square);
  43. }
  44.  
  45. // konstruktor
  46. public printAll() {
  47. // Panggil method cetakAngka
  48.  
  49.  
  50. // Panggil method cetakHuruf
  51. getName();
  52. getArea();
  53. }
  54.  
  55. }
Add Comment
Please, Sign In to add comment