Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: polymorphism problem

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    My Mood
    Worried
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default polymorphism problem

     
    public static void main(String[] args) {
     
     
      Scanner scanner = new Scanner(System.in);
     
     
      int side = 0;  
      int area = 0;
      int perimeter = 0;
     
     
      System.out.println("Enter the length of side of square ");
     
     
      side = scanner.nextInt();
     
     
      area = side * side;
     
      perimeter = 4 * side;
     
     
      System.out.println("Area of Square is : " + area);
      System.out.println("Perimeter of Square is : " + perimeter);
     }
    }

    i need help regarding polymorphism method can my code implement Method Overloading orOverriding. need an advice how it wokrk

  2. #2
    Member
    Join Date
    May 2017
    Location
    Eastern Florida
    Posts
    68
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default Re: polymorphism problem

    Take a look at the tutorial: Overriding and Hiding Methods (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)

Similar Threads

  1. Polymorphism
    By gautammuktsar@gmail.com in forum Object Oriented Programming
    Replies: 1
    Last Post: March 5th, 2014, 02:15 PM
  2. Not Understanding Polymorphism
    By superjacko in forum Java Theory & Questions
    Replies: 5
    Last Post: July 28th, 2013, 11:47 PM
  3. Inheritence and Polymorphism
    By Spanky_10 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 1st, 2013, 07:59 AM
  4. Polymorphism Question
    By BuhRock in forum Java Theory & Questions
    Replies: 1
    Last Post: October 1st, 2012, 11:09 AM
  5. Polymorphism.
    By TP-Oreilly in forum Java Theory & Questions
    Replies: 2
    Last Post: March 11th, 2012, 09:28 AM