---
title: "Interface in oops"  
description: "I am thankful to all for reading my blogs and correct my mistake and suggest me much better about oops.I am going to discuss interface role in oops.We"  
author: "ANkita gupta"  
published: 2015-04-30  
updated: 2018-02-23  
canonical: https://www.mindstick.com/blog/10876/interface-in-oops  
category: "java"  
tags: ["oops"]  
reading_time: 1 minute  

---

# Interface in oops

I am thankful to all for [reading](https://www.mindstick.com/articles/126273/books-commonly-found-on-college-reading-lists) my [blogs](https://www.mindstick.com/developersection/blog) and correct my [mistake](https://yourviews.mindstick.com/view/88393/ai-humanity-s-greatest-invention-or-final-mistake) and [suggest me](https://www.mindstick.com/forum/34229/can-anyone-suggest-me-must-to-do-on-page-optimization-activities-in-websites) much better about oops.

I am going to discuss [interface](https://www.mindstick.com/articles/12101/interfaces-in-java-extending-interfaces) role in oops.

We already learned [objects](https://www.mindstick.com/forum/145447/what-are-objects) define their [interaction](https://yourviews.mindstick.com/view/80771/technology-is-destroying-human-interaction-how) with the outside world through the [methods](https://www.mindstick.com/articles/13060/runny-nose-remedy-methods-that-work-best) that they expose.

Methods from the objects interface with outside world, the buttons on the [front of your](https://yourviews.mindstick.com/story/2347/conversations-should-never-make-in-front-of-your-kids) TV set, for e.g.,

are the interface b/w you & the electrical wiring on the other side of its plastic casing. You press the "power" button to turn the television ON & OFF.

**E.g. using interface.**

```
interface SessionIDCreator extends Serializable, Cloneable {
        String TYPE = "AUTOMATIC";
        int createSessionId();
    }
    class SerialSessionIDCreator implements SessionIDCreator {
        private int lastSessionId;
        @Override
        public int createSessionId() {
            return lastSessionId++;
    }
}
```

In above example of an interface in Java, SessionIDCreator is an interface while SerialSessionIDCreator is an [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) of the interface.

---

Original Source: https://www.mindstick.com/blog/10876/interface-in-oops

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
