zoukankan      html  css  js  c++  java
  • 第八周上机作业

    1.package finish;
    import java.util.Scanner;
    
            public class finish{
                public static void main(String[] args){
                    Computer c1 = new Computer();
                    c1.showComputer();
                    Computer c2 = new Computer('红',32);
                    c2.showComputer();
                }
                
            }
            class Computer{
                private char color;
                private int cpu;
                public Computer(){
                    
                }
                public Computer(char color,int cpu){
                    this.color=color;
                    this.cpu=cpu;
                }
                public char getColor(){
                    return color;
                }
                public void setColor(char color){
                    this.color=color;
                }
                public int getCpu(){
                    return cpu;
                }
                public void setCpu(int cpu){
                    this.cpu=cpu;
                }
                public void showComputer(){
                    System.out.println("笔记本的颜色:"+getColor());
                    System.out.println("笔记本的cpu型号:"+getCpu());
                    
                }
            }
    2.package finish;
    import java.util.Scanner;
         public class finish{
                String name;// 姓名
                double height;// 身高
                int age;// 年龄
                finish(String name, double height, int age) {
                    this.name = name;
                    this.height = height;
                    this.age = age;
                }
    
                void sayHello() {
                    System.out.println("hello,my name is  " + name+" "+height+"m"+" "+age+"岁");
                }
            }
    public class personCreate {
    
            public void main(String[] args) {
                person c1 = new person("zhangsan", 1.73, 33);
                person c2 = new person("lishi", 1.74, 44);
    
                c1.sayHello();
                c2.sayHello();
            }
        }
    }
  • 相关阅读:
    取物料特性
    MATCHCODE OBJECT 属性是什么意思
    SAPABAP用户权限检查
    FOR ALL ENTRIES的原理:
    上传EXCEL和text到SAP内表 ,SAP内表导出EXCEL
    屏幕设计设置默认值
    使用JOIN关联多张数据库表
    WHERE spras = sylangu.这是什么意思
    DESCRIBE TABLE
    取批次特性值
  • 原文地址:https://www.cnblogs.com/csy521/p/12759877.html
Copyright © 2011-2022 走看看