Skip to content
View madobon's full-sized avatar

Block or report madobon

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
madobon/README.md

😄About me

public class PersonalIntroduction {

    public static void main(String[] args) {
        var person = Person.createPerson();
        System.out.println(person);
    }
}

class Person {
    private final String name;
    private final Hobby[] hobbies;
    private final WorkExperience[] workExperiences;

    private Person(String name, Hobby[] hobbies, WorkExperience[] workExperiences) {
        this.name = name;
        this.hobbies = hobbies;
        this.workExperiences = workExperiences;
    }

    public static Person createPerson() {
        var hobbies = new Hobby[] {
            new Hobby("Home Gardening"),
            new Hobby("Motorcycling"),
            new Hobby("Drones")
        };
        var workExperiences = new WorkExperience[] {
            new WorkExperience("SES Company", 6),
            new WorkExperience("E-Commerce", 7),
            new WorkExperience("Fintech", 0)
        };
        return new Person("John Doe", hobbies, workExperiences);
    }

    @Override
    public String toString() {
        var sb = new StringBuilder();
        sb.append("Name: ").append(name).append("\n")
          .append("Hobbies:\n");
        for (var hobby : hobbies) {
            sb.append("- ").append(hobby).append("\n");
        }
        sb.append("Work Experience:\n");
        for (var experience : workExperiences) {
            sb.append("- ").append(experience).append("\n");
        }
        return sb.toString();
    }
}

record Hobby(String name) {}

record WorkExperience(String type, int years) {
    @Override
    public String toString() {
        return type + " (" + years + " years)";
    }
}

Pinned Loading

  1. madobon madobon Public

    aboutme