Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Info1 {
- String name;
- int age;
- public Info1() {
- name = "홍길동";
- age = 21;
- }
- public Info1(String str, int num) {
- name = str;
- age = num;
- }
- public void prtInfo1() {
- System.out.println("이름 : "+name);
- System.out.println("나이 : "+age);
- }
- }
- public class InfoS extends Info1 {
- String add;
- public InfoS(String string, int i, String string2) {
- super(string, i);
- add = string2;
- }
- public InfoS() {
- super();
- }
- public void prtInfo1() {
- /*
- System.out.println("이름 : "+name);
- System.out.println("나이 : "+age);
- */
- super.prtInfo1();
- System.out.println("주소 : "+add);
- }
- public static void main(String[] args) {
- InfoS obj1 = new InfoS();
- obj1.name = "【=◈︿◈=】";
- obj1.age = 34;
- obj1.add = "경기도 이천시 마장면 해월리";
- obj1.prtInfo1();
- InfoS obj2 = new InfoS("오승주", 20, "경기도 군포시");
- obj2.prtInfo1();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement