java - Is Method overloading is also known as static polymorphism? -


iam newbie java in below code have oveloaded print method between 2 different classes

based on object @ runtime corresponding print method executed.if understanding right how can method overloading considered static ploymorphism

class parent {     private int arg;     public void print(int arg)     {         this.arg=arg;         system.out.println(arg+"printed");     } } class child extends parent{      private string arg;     public void print(string arg)     {         this.arg=arg;         system.out.println(arg+"printed");     }     public static void main(string[] args) {         // todo auto-generated method stub         parent p1=new parent();         child ch=new child();         p1.print(1);         ch.print("string");     }  } 

please clarify me.thanks in advance

try reading , may clear doubts how polymorphism works can't access object in array java


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -