梵高摔电脑 2021-11-16 23:50 采纳率: 25%
浏览 5

029-类class type 方法method.

 

一个错误的程序,不知道问题出在哪里??

public class People{

    public static void main(String[] args){

    double height;

    int age;

    int sex;

    void cry(){

        System.out.println("i am crying!");

    }

    void laugh(){

        System.out.println("i am laughing!");

    }

    void printBaseMes(){

        System.out.println("my height is"+height+"cm");

        System.out.println("my age is"+age+"old");

        if(this.sex ==0)

        System.out.println("I am male!");

        else

        System.out.println("I am female!");

    }

   

    cry();

    laugh();

    printBaseMes();

   }

 

}

  • 写回答

2条回答 默认 最新

  • 眰恦.H 2021-11-17 00:04
    关注

    你好,需要帮助吗

    评论

报告相同问题?

问题事件

  • 创建了问题 11月16日

悬赏问题

  • ¥15 求复现机器学习文章一篇
  • ¥15 爬虫抓取数据|解析视频文本内容(相关搜索:自动化)
  • ¥15 combobox绑定值改变的问题
  • ¥15 from seleniumwire import webdriver 在抓取http://链接的时候会自动转https://这个怎么解决
  • ¥15 hive直连数据库模式插入mysql表数据失败(相关搜索:数据库)
  • ¥30 不会,学习,有偿解答
  • ¥15 SQL查询语句报错(检查)
  • ¥15 此表中公式应该怎么写
  • ¥15 求HI-TECH PICC 9.50 PL3安装包
  • ¥15 下载ctorch报错,求解