Institute of Computer Science
  1. Courses
  2. 2018/19 spring
  3. Object-Oriented Programming (Narva College) (LTAT.NR.003)
ET
Log in

Object-Oriented Programming (Narva College) 2018/19 spring

  • Home
  • Materials
  • Java Glossary
  • Source Example
  • Cheat sheet (S1-S6)
  • Grading
  • Links
Session 6

Abstract methods

Before we are going to plunge into interfaces and abstract classes, have a look at abstract methods.

An abstract method is a method that has a modifier, return type, and method signature followed by a semicolon. Abstract methods do not have bodies nor braces { }. A few examples of abstract methods:

     public abstract void eat(int grams);  //abstract void method
     public abstract String bark(String dogName);  //abstract return-type method

Remember: it is not possible to make an abstract constructor or an abstract static method!

Apart from abstract methods, it is possible to create abstract instance fields. Abstract instance fileds is not possible to initialized:

     modifier dataType instanceFieldName;  //abstract instance field are not initialized
Session 6
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment