Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7415387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:17:39+00:00 2026-05-29T07:17:39+00:00

I am struggling to explain oop concepts in java. A major tenet in oop

  • 0

I am struggling to explain oop concepts in java.

A major tenet in oop is that objects have methods; so Object.method(); works.
I am contrasting this with procedural programming in which one must do method(Object).

Is this called encapsulation?

What are the advantages of the oop way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:17:40+00:00Added an answer on May 29, 2026 at 7:17 am

    2 more advantages of OOP are re-use and polymorphism.

    ReUse:
    If you use doSomething(Object) in one file or one program, it may work fine for that program. Now, imagine that you need to use your Object in another program. You will need to duplicate the doSomething() method in your new program (probably copy and paste it). This may work, but is bad practice and makes maintaining that logic a nightmare. If the doSomething() logic is a function inside Object then that logic “lives” with the object.

    Polymorphism:
    Imagine another case where Object is just one of many similar types. If you take advantage of Interfaces, many objects can implement the doSomething() function to suit their specific needs.

    Example:

    interface ICar
    {
        void doSomething();
        void getFuel();
    }
    
    class GasCar : ICar
    {
        public void doSomething()
        {
            //do something a gas car would do
        }
        public void getFuel()
        {
            //logic to pull gas out of a tank
        }
    }
    
    class ElectricCar : ICar
    {
        public void doSomething()
        {
            //do something an electric car would do
        }
        public void getFuel()
        {
            //logic to pull fuel out of a battery
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm struggling with add_custom_command. Let me explain the problem in detail. I've these set
I've been struggling for a while with this one; I'll try to explain it
Sorry in advance, I'm struggling a bit with how to explain this... :) Essentially,
Struggling with styling the mouse over for a button ... I have managed to
Iam struggling with NHibernate and its lazyload. I have a structure which I simplified
been struggling with an issue now for a day or two. I have an
I have written a MVVM prototype as a learning exercise and I am struggling
I'm struggling big time understanding how to use the DOMElement object in PHP. I
I'm struggling to get some var'ed values into jquery selector. // this works below
I am struggling with the route setup for a Rails application. I have installed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.