zoukankan      html  css  js  c++  java
  • JAVA练习题8

    package cn.person.www;

     
    public class person {
         
        public int id;
        public String name;
        public int age;
        public String city;
        public String introduce() {
            return "我是" + id + "号, 叫  " + name + ", 今年" + age + "岁了, 来自" + city ;
        }
     public person(int id,String name,int age,String city) {
         this.id=id; //this关键字,表达的含义是当前对象 .表示当前对象的某个调用
         this.name=name;
         this.age=age;
         this.city=city;
     }
             
    }

     package cn.person.www;

     
    public class Demoperson {
     
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            person p1=new person(001,"刘备",40,"北京");
            person p2=new person(002,"关羽",37,"北京");
            person p3=new person(003,"张飞",45,"北京");
            person p4=new person(004,"诸葛亮",25,"北京");
             
            System.out.println(p1.introduce());
            System.out.println(p2.introduce());
            System.out.println(p3.introduce());
            System.out.println(p4.introduce());
             
        }
     
    }

  • 相关阅读:
    java工程中的相关路径
    cxf 消息寻址
    cxf数据压缩
    cxf开发Restful Web Services
    cxf构建webservice的两种方式
    使用cxf构建webservice
    thumbnailator图片处理
    WinFom中经典小游戏(含源码)
    WinForm中使用DDE技术(含源码)
    EntityFrameWork连接多Db配置
  • 原文地址:https://www.cnblogs.com/qxc81518/p/7822639.html
Copyright © 2011-2022 走看看