Skip to header Skip to main navigation Skip to main content Skip to footer

User account menu

  • Log in
Home
COPA
Computer Operator and Programming Assistant

Main navigation

  • Home
    • COPA Assessment Criteria
    • COPA Job Role
    • Course Information
  • Books
  • Question Paper
  • Syllabus

Concept of Virtual methods

Breadcrumb

  • Home
  • Introduction to Programming in Java
  • Concept of Virtual methods

Network

ITI Trade Subject

  • ITI Electrician
  • ITI Fitter
  • ITI COPA
  • ITI Welder
  • ITI Mechanic
  • ITI Electronics
  • ITI Wireman
  • ITI Draughtsman Civil & Mech
  • ITI Refrigeration & Air Conditioning
  • ITI Turner
  • ITI Plumber
  • ITI Machinist
  • ITI Cosmetology
  • ITI Sewing
  • ITI Surveyor
By Anand | 12:45 PM IST, Fri March 13, 2026

Concept of Virtual Methods in Java

Java is an object-oriented programming language that supports powerful features such as inheritance, polymorphism, and dynamic method execution. One important concept related to polymorphism is the virtual method. Virtual methods help Java determine which method should be executed during program runtime.

The concept of virtual methods is closely related to method overriding and runtime polymorphism. In Java, when a method is overridden in a subclass, the method that gets executed depends on the type of object at runtime rather than the type of reference variable.

For students studying the ITI COPA (Computer Operator and Programming Assistant) trade, understanding virtual methods helps in learning how Java programs dynamically decide which method to execute.

What is a Virtual Method?

A virtual method is a method whose implementation is determined at runtime rather than during compilation.

In Java, all non-static methods are virtual by default. This means that the method that gets executed depends on the object type, not the reference type.

Virtual methods enable Java to support runtime polymorphism, which is an important feature of object-oriented programming.

Understanding Virtual Methods

Consider a situation where a parent class defines a method and a child class overrides that method. When an object of the child class is accessed using a reference of the parent class, Java decides which method to execute at runtime.

This behavior is known as dynamic method dispatch and is possible because of virtual methods.

Example

class Animal {

    void sound() {
        System.out.println("Animal makes a sound");
    }

}

class Dog extends Animal {

    void sound() {
        System.out.println("Dog barks");
    }

}

In this example, the sound() method is overridden in the Dog class.

Example Program Demonstrating Virtual Method

public class VirtualMethodExample {

    public static void main(String[] args) {

        Animal a = new Dog();

        a.sound();

    }

}

Output:

Dog barks

Although the reference variable is of type Animal, the method of the Dog class is executed. This happens because Java uses virtual methods to determine the correct method at runtime.

Dynamic Method Dispatch

Dynamic method dispatch is the mechanism by which Java determines which overridden method should be executed at runtime.

When a superclass reference variable refers to a subclass object, Java uses the object's type to determine which method should be executed.

Example

class Shape {

    void draw() {
        System.out.println("Drawing shape");
    }

}

class Circle extends Shape {

    void draw() {
        System.out.println("Drawing circle");
    }

}

class Rectangle extends Shape {

    void draw() {
        System.out.println("Drawing rectangle");
    }

}

Main Program

public class TestShape {

    public static void main(String[] args) {

        Shape s;

        s = new Circle();
        s.draw();

        s = new Rectangle();
        s.draw();

    }

}

Output:

Drawing circle
Drawing rectangle

The method executed depends on the object type assigned to the reference variable.

Characteristics of Virtual Methods

Virtual methods have several important characteristics in Java.

  • They support runtime polymorphism.
  • The method to be executed is determined at runtime.
  • They allow subclasses to override parent class methods.
  • They improve flexibility in program design.

Because of these features, virtual methods are widely used in Java applications.

Methods That Cannot Be Virtual

Certain methods in Java cannot behave as virtual methods.

  • Static methods
  • Private methods
  • Final methods

These methods cannot be overridden by subclasses, so they do not participate in runtime polymorphism.

Example of Final Method

class Animal {

    final void display() {
        System.out.println("This method cannot be overridden");
    }

}

The display() method cannot be overridden because it is declared as final.

Advantages of Virtual Methods

  • Supports runtime polymorphism
  • Improves program flexibility
  • Allows dynamic method execution
  • Enhances code reusability

These advantages make virtual methods an essential part of object-oriented programming.

Applications of Virtual Methods

Virtual methods are widely used in software development.

  • Graphical user interface frameworks
  • Game development engines
  • Enterprise software systems
  • Plugin-based applications

Many large Java frameworks rely heavily on dynamic method dispatch.

Importance for ITI COPA Students

For students studying the ITI COPA trade, learning about virtual methods helps in understanding how Java programs dynamically select methods during runtime.

This concept is essential for learning advanced object-oriented programming topics such as polymorphism, inheritance, and software design patterns.

Understanding virtual methods also helps students develop flexible and scalable Java applications.

Conclusion

Virtual methods are an important concept in Java that allow method calls to be resolved during runtime. They play a key role in achieving runtime polymorphism and dynamic method dispatch.

By using virtual methods, Java programs can execute different implementations of a method depending on the object type.

For ITI COPA students, mastering the concept of virtual methods helps in understanding advanced Java programming concepts and building efficient object-oriented applications.

Book traversal links for Concept of Virtual methods

  • ‹ Concept of Abstract classes and methods
  • Up
  • Constructors and Overloaded constructors ›
  • Printer-friendly version

Article

Types of Files in Computer System
Safety Signs and Symbols Used in Workplace
Safety Rules While Using Computer
Can I start my own business after doing ITI in COPA trade?
Scope in Government Jobs after Doing ITI in COPA

Books

Introduction to Programming in Java
Programming language (Python)
Cloud Computing
Cyber Security
Advanced Excel Concepts
Database Concepts
Communicating in a Connected World
Using Spread Sheet Application
Designing Static Web Pages
Internet Concepts
Configuring and Using Networks
Database Management
Image editing, Creating presentations & Using Open Office
Using Word Processing Software
Familiarization with DOS CLI & Linux Operating Systems.
🖥️ Computer Hardware Basics and Software Installation
🖥️ Computer Components and Windows Operating System
Cyber Security
E Commerce
Smart Accounting
Introduction to VBA, Features and Applications
Introduction to JavaScript 🧠💻
Web Design Concepts
Internet Concepts 🌐
Networking Concepts 🌐
🗄️ Database Management Systems (DBMS)
Power Point Presentations
📊 Spreadsheet Application – Trade Theory for COPA
📝 Word Processing – Trade Theory for COPA
🖥️ Introduction to DOS Command Line Interface & Linux Operating System – Trade Theory for COPA
🖥️ Computer Hardware Basics and Software Installation – Trade Theory for COPA
Introduction to Computers and Windows Operating System

Question Paper

Hindi

COPA 2024 – प्रश्न पत्र सेट 11
COPA 2024 – प्रश्न पत्र सेट 1
COPA 2024 – प्रश्न पत्र सेट 2
COPA 2024 – प्रश्न पत्र सेट 3
COPA 2024 – प्रश्न पत्र सेट 4
COPA 2024 – प्रश्न पत्र सेट 5
COPA 2024 – प्रश्न पत्र सेट 6
COPA 2024 – प्रश्न पत्र सेट 7
COPA 2024 – प्रश्न पत्र सेट 8
COPA 2024 – प्रश्न पत्र सेट 9
COPA 2024 – प्रश्न पत्र सेट 10

English

ITI COPA 2023 Question Paper
ITI COPA 2023 Question Paper – Set 2
ITI COPA 2023 Question Paper – Set 3
ITI COPA 2023 Question Paper – Set 4

Common Subject

  • Engineering Drawing
  • Employability Skills
  • Workshop Calculation Science

Directory

  • Industrial Training Institutes
  • Engineering College
  • Medical College

Knowledge Bank

  • ITI Syllabus
  • Tools

Copyright © 2026 Company Name - All rights reserved

Developed and Designed by Alaa Haddad at Flash Web Center, LLC