博客
关于我
Java语言基础7
阅读量:91 次
发布时间:2019-02-26

本文共 1642 字,大约阅读时间需要 5 分钟。

??????????????????????????????????????private????this?????????????

1. ????????????

??????????????????????????????????????????

????

  • ????????????????????
  • ?????????????????????
  • ???????????????????????????
  • ??????????????????????
  • ????????????????????????????
  • 2. ?????????

    Java????????????

    ???????

  • ???????????????
  • ????????????????
  • 3. ????

    ??????????????????????????????

    ?????

  • ?????? Student().show()?
  • ???????method(new Student())?
  • 4. ??

    ?????????????????????????????????

    private???

    ????????????????????

    5. this???

    ?????????????????????????????

    6. ????

    ????????????????????????????

    ?????????

  • ????????????????????
  • ???????????????????
  • ??????????????????????
  • 7. Student s = new Student();

    ???????????

  • ??????
  • ???????????
  • ?????????
  • ???????
  • ??????
  • ?????????
  • ?????????????
  • 8. ?????

    import java.util.Scanner;class MyMath {    public int add(int a, int b) {        return a + b;    }    public int sub(int a, int b) {        return a - b;    }    public int mul(int a, int b) {        return a * b;    }    public int div(int a, int b) {        return a / b;    }}class MyMathTest {    public static void main(String[] args) {        Scanner sc = new Scanner(System.in);        System.out.println("??????????");        int firstNumber = sc.nextInt();        System.out.println("??????????");        int secondNumber = sc.nextInt();        MyMath mm = new MyMath();        System.out.println("?????" + mm.add(firstNumber, secondNumber));        System.out.println("?????" + mm.sub(firstNumber, secondNumber));        System.out.println("?????" + mm.mul(firstNumber, secondNumber));        System.out.println("?????" + mm.div(firstNumber, secondNumber));    }}

    转载地址:http://hnmz.baihongyu.com/

    你可能感兴趣的文章
    Python 中如何处理异常?
    查看>>
    Python 中如何实现列表的切片?
    查看>>
    Python 中如何实现字典的排序?
    查看>>
    Python 中常用的数据类型及相关操作详解
    查看>>
    Python 中的注意点_s2
    查看>>
    Python 中的生成器是什么?
    查看>>
    Python 中的离线语音转文本
    查看>>
    Python读写json文件的简单实现
    查看>>
    Python 中的线程
    查看>>
    Python 中的继承机制是什么样的?
    查看>>
    python读写excel之xlrd&xlwt&xlutils组合
    查看>>
    Python 中的装饰器是什么?
    查看>>
    Python 中的装饰器是如何工作的,有哪些实际应用场景?
    查看>>
    python读excel
    查看>>
    Python 中读取 CSV 文件-ChatGPT4o作答
    查看>>
    Python 之 filecmp
    查看>>
    python请求html_使用Python请求获取HTML?
    查看>>
    Python 之匿名函数和偏函数
    查看>>
    python 之栈的实现
    查看>>
    python语音播放
    查看>>