/**
* A basic class representing a person with their name and years of coding experience. 👨💻
*/
class Person {
protected String name;
protected int yearsCoding;
public Person(String name, int yearsCoding) {
this.name = name;
this.yearsCoding = yearsCoding;
}
/**
* Introduces the person. 👋
*/
public void introduce() {
System.out.println("Hi, I'm " + name + "!");
System.out.println("I've been coding for " + yearsCoding + " years.");
}
}
/**
* A class for a developer who loves coding. 👀💻
*/
public class AboutMe extends Person {
private String[] favoriteLanguages;
private String favoriteActivity;
private String major;
public AboutMe(String name, int yearsCoding, String[] favoriteLanguages, String favoriteActivity, String major) {
super(name, yearsCoding);
this.favoriteLanguages = favoriteLanguages;
this.favoriteActivity = favoriteActivity;
this.major = major;
}
/**
* Prints out more details about this person, such as favorite languages and activity. 🌟🚀
*/
@Override
public void introduce() {
super.introduce();
System.out.println("I'm an undergraduate student pursuing a major in " + major + "! 🎓");
System.out.println("I'm passionate about " + favoriteActivity + ".");
System.out.println("Some languages I enjoy coding in are:");
for (String language : favoriteLanguages) {
System.out.println(" - " + language);
}
}
public static void main(String[] args) {
String[] favoriteLanguages = {"Java", "TypeScript", "Python"};
AboutMe me = new AboutMe("Arturo", 3, favoriteLanguages, "exploring AI and creating impactful code", "Computer Science at ITESM Qro");
me.introduce();
}
}
Highlights
- Pro
Pinned Loading
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.