18 Answered Questions for the topic oop


Java Programming Language

java Programming1. Design a class named Employee_Salary that contains:• A String data field named name representing the name of the employee.• A String data field named position representing the... more


How to code for creating a class?

You probably are fond of games. This quiz though is not that complicated. You are simply going to work with a point on a screen, and a circle on a screen as well. And let's consider them as the... more
Oop Java


How to construct a class?

Construct a class called Term. It is going to represent a term in polynomial expression. It has an integer coefficient and an exponent. In this case, there is only 1 independent variable that is... more
Oop Java


How to create an OOP?

Create a new file called Account.java and construct a class called Account, which models a simple bank account. It contains the following members:  Two private instance... more
Oop Java


"District Information System” application

As a programmer, you have been asked to write a Java application, using OOP concepts, for a District. The district contains many buildings, and each building has several apartments. You need to... more

“Hospital Information System” application

As a programmer, you have been asked to write a Java application, using OOP concepts, for a Hospital with the following requirements:• The Hospital has several employees and each one of them has an... more

What does it mean to "program to an interface"?

I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? I know what interfaces do, but the fact I am not clear on this makes me think I am... more

Interface vs Base class?

When should I use an interface and when should I use a base class? Should it always be an interface if I don't want to actually define a base implementation of the methods?

Prefer composition over inheritance?

Why prefer composition over inheritance? What trade-offs are there for each approach? When should you choose inheritance over composition?

What's the difference between a method and a function?

Can someone provide a simple explanation of methods vs. functions in OOP context?


What are the differences between type() and isinstance()?

What are the differences between these two code fragments?Using `type()`: import types if type(a) is types.DictType: do_something() if type(b) in types.StringTypes: ... more

What is the point of interfaces in PHP?

Interfaces allow you to create code which defines the methods of classes that implement it. You cannot however add any code to those methods. Abstract classes allow you to do the same thing, along... more

Calling base class overridden function from base class method?

public class A {  public void f1(String str) {   System.out.println("A.f1(String)");   this.f1(1, str);  }    public void f1(int i, String str) { ... more

How would you access Object properties from within an object method?

What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method?I know that from outside of the object you should use a... more

What are metaclasses in Python?

What are metaclasses and what do we use them for?

Meaning of @classmethod and @staticmethod for beginner?

Could someone explain to me the meaning of `@classmethod` and `@staticmethod` in python? I need to know the difference and the meaning. As far as I understand, `@classmethod` tells a class that... more


Understanding Python super() with __init__() methods?

I'm trying to understand the use of `super()`. From the looks of it, both child classes can be created, just fine. I'm curious to know about the actual difference between the following 2 child... more


What is the purpose of self?

What is the purpose of the `self` word in Python? I understand it refers to the specific object created from that class, but I can't see why it explicitly needs to be added to every function as a... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.