Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Iplementation of Constructor Dependency Injection
- public class AnimalConstruct {
- private String species;
- private String ras;
- // Constructor Dependency Injection
- AnimalConstruct(String species, String ras) {
- this.species = species;
- this.ras = ras;
- }
- }
- public class AnimalSetValueConstruct {
- AnimalConstruct animalConstruct = new AnimalConstruct( "Kucing", "Anggora" );
- }
- // Iplementation of Setter Dependency Injection
- public class AnimalSetter {
- private String species;
- private String ras;
- // Setter Dependency Injection
- public void setSpecies(String species) {
- this.species = species;
- }
- public void setRas(String ras) {
- this.ras = ras;
- }
- }
- public class AnimalSetValueSetter {
- public void Setter()
- {
- AnimalSetter animalSetter = new AnimalSetter();
- animalSetter.setSpecies("Kucing");
- animalSetter.setRas("Anggora");
- }
- }
Add Comment
Please, Sign In to add comment