zoukankan      html  css  js  c++  java
  • Java第四次作业

    1

    public class Dog { private String name; private String color; private int age; public Dog(String name, String color, int age) {   this.name = name;   this.color = color;   this.age = age; } public void print() {   System.out.print("名字: " + this.name + " " + "颜色:" + this.color + " "     + "年龄:" + this.age); } public String getName() {   return name; } public void setName(String name) {   this.name = name; } public String getColor() {   return color; } public void setColor(String color) {   this.color = color; } public int getAge() {   return age; } public void setAge(int age) {   this.age = age; } }

    2

    public class User { private String name; private String password; private static int num; public User() {   num++; } public User(String name) {   this.name = name;   num++; } public User(String name, String password) {   this.name = name;   this.password = password;   num++; } public void print() {   System.out.print("用户个数:" + num + " ");   System.out.println("名字: " + name + " " + "口令:" + password + " "); } public String getName() {   return name; } public void setName(String name) {   this.name = name; } public String getPassword() {   return password; } public void setPassword(String password) {   this.password = password; } }

  • 相关阅读:
    camke 参数
    17.计算1-100之和+1-50的平方和+1-10的倒数
    16.求Sn=a+aa+aaa+aaaa.......之值
    15.计算1!+2!+3!+.....20!=?
    14.输出所有的“水仙花”
    13.企业发放的奖金根据利润提成
    12.输入一个成绩计算其A,B,C,D,E等级
    11.键盘输入小于1000的整数
    10.求方程的根
    2019考研历程回顾
  • 原文地址:https://www.cnblogs.com/WFYL/p/6599327.html
Copyright © 2011-2022 走看看