What is a supertype method?

后端 未结 6 1319
情话喂你
情话喂你 2021-02-03 14:12

I have googled couple of times but still can\'t understand the supertype method. Can anyone please explain what is this?

6条回答
  •  臣服心动
    2021-02-03 14:48

    if you are talking about calling a super method, you should try the following

    1. create a class with a method public method e.g. printSomething()

      public void printSomething() { System.out.println("hello, I am the first class"); }

    2. create a second class which inherites from the first class and override the printSomething method

      @override public void printSomething() { super.printSomething(); }

    3. write a small programm which call the method printSomething of class two and see what will happen

提交回复
热议问题