美文网首页
2020-02-24

2020-02-24

作者: 等一个人咖啡_2c04 | 来源:发表于2020-02-29 16:48 被阅读0次

    JAVA面向对象的学习

    定义类的方法

    class  类名

    {

    属性:

    方法;

    }

    属性:也叫成员变量,主要用于描述类的状态

    方法:也叫成员方法,主要用于类的行为

    class person  {

    int  age;

    void   shout(){

    System.out.println("Oh my");

    }

    }

    生成对象的方法

    类名 对象名=new 类名

    格式:Dog dog=new Dog();

    相关文章

      网友评论

          本文标题:2020-02-24

          本文链接:https://www.haomeiwen.com/subject/ptziqhtx.html