UrbanPro

Learn Java Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is use of interface in Java language?

Asked by Last Modified  

16 Answers

Learn Java

Follow 0
Answer

Please enter your answer

Expert in Java J2EE Training

Polymorphism is one of the key uses of inheritance. For ex, there are many implementations of List interface. Any implementation can be taken as a list object. List list = new ArrayList(), List list2 = new LinkedList etc., This goes to many levels.
Comments

Software Testing Trainer(Automation)

basically its correct to achieve multiple inheritance ,since its due to abstract method .we use interface to force to use already decided design pattern
Comments

IT Professional Trainer with 13 years of experience in IT industry + Academics

Java doesn't support multiple inheritance. In terms of interface you can implement that concept because You would be allowed to implement more than one interfaces in one class
Comments

Expert in Java/J2ee technology

In Java 1.8, Interface can contain the default body of a method which is called default method.
Comments

Trainer

Interface is used when There only abstract methods in the java interface not method body. It is used to achieve fully abstraction and multiple inheritance in Java.
Comments

More than 12 years of experience in IT Industry including Science/Computer teaching

Interface are used to code re-usability, and they are the real driver of ploymorphism in Java. Interface are also allows multiple inheritance in java.
Comments

16 Yrs of Experience in Teaching

It's like forcing to someone implement this task any how .. java does not support multiple inheritance , if i want to force by abstract class and also extends some other class it is not possible , so we can force it by interface we can also implement multiple interfaces at a time , interfaces have abstract...
read more
It's like forcing to someone implement this task any how .. java does not support multiple inheritance , if i want to force by abstract class and also extends some other class it is not possible , so we can force it by interface we can also implement multiple interfaces at a time , interfaces have abstract methods which must be implemented by extended class .... usually as a team leader of 15 employees i used to create interface to take surety that every class has same method name. read less
Comments

Experienced Software Professional

It is a contract or behaviour which a class that implements that interface must implement. Another use it that it lets Java programs implement "Multiple inheritance of TYPE" which is the ability to implement more than one interface.
Comments

Trainer

An interface in Java has remained a complex topic for many beginners to understand. The first thing which puzzles many programmers is the fact that you cannot define any method inside interface, it a just declaration. By rule, all method inside interface must be abstract (Well, this rule is changing...
read more
An interface in Java has remained a complex topic for many beginners to understand. The first thing which puzzles many programmers is the fact that you cannot define any method inside interface, it a just declaration. By rule, all method inside interface must be abstract (Well, this rule is changing in Java 8 to allow lambda expressions, now interface can have one non-abstract method, also known as a default method). So, if you can't define anything, Why we need an interface? what's the use of an interface, if we are anyway going to write a class and override them to provide behaviour, Can't we declare those methods inside the class itself without using interface etc. Well, if you are thinking in terms of behaviour then you are really missing the point of interface. read less
Comments

Trainer

As you know that Java does not allow multiple inheritance. Sometime in our real life we need to use multiple inheritance for example an amphibious animal inherits the behaviours of Aquatic and Terrestrial animals together, i.e. can walk on land as well as swim in water. To show the relationships in...
read more
As you know that Java does not allow multiple inheritance. Sometime in our real life we need to use multiple inheritance for example an amphibious animal inherits the behaviours of Aquatic and Terrestrial animals together, i.e. can walk on land as well as swim in water. To show the relationships in Java we can use Interface, which allows a class to implement more than one interface at a time. Moreover if we want to make all methods as abstract, we can use interface and provide the freedom to end developer to write own definitions for all methods in the implementing (concrete) class. read less
Comments

View 14 more Answers

Related Questions

Which is best to build web applications: PHP, Python, or Ruby? Why?
I have used almost all of the three language in my web working experience.PHP:It may be not that cool and I think it doesn't rely too much on the framework. Yes, PHP is just a language, but it is the only...
Sunil
0 0
7

I am a fresher and I want to become a Java developer, so what is necessary to crack the Java interview ? 

For an interview, you should prepare all the basic questions of Java , class, function and OOP concepts.
Dipesh
why string class is override in euals()/ hashCode Hethods?
Equals method and hash code methods compare two objects based the memory location occupied by objects. Two different objects always occupy two different locations in heap memory. So equals and hashCode...
Rami Reddy
Can we print any string in Java without a semicolon?
Yes We can print a string with out semicolon in if statement. public class Print_Without_Semicolon { public static void main(String args) { int i = 0; if(System.out.printf("print...
Sridevi
0 0
6

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

History Of Java
Java history is interesting to know. The history of java starts from Green Team. Java team members (also known as Green Team), initiated a revolutionary task to develop a language for digital devices such...
V

Use of Service Locator Pattern
If we want to reuse the java code that should be the best approach w.r.t re-usability, maintanence and saving time to concentrate on our own businbess logic/requirement. In the similar approach many patterns...
M

Class and Objects in Java
Class is a template or a blueprint which is used to describe an object. On other hand Object is a reference of a class which follows all the stuff written inside the class. How about taking the whole tour in the following video

Java Learning Tip
The easy way to learn any programatical language is just simple practices. Take a simple examples and practice daily one hour. And also go through the learning videos from youtube or somewhere else.

Difference Between Checked And Un-Checked Exception
1. Exception is an abnormal condition in the program, if raises program terminates abnormally. 2. Exception always occurs at runtime only, there is no chance of exception at compile time. 3. Syntactical...

Recommended Articles

Before we start on the importance of learning JavaScript, let’s start with a short introduction on the topic. JavaScript is the most popular programming language in the world, precisely it is the language - for Computers, the Web, Servers, Smart Phone, Laptops, Mobiles, Tablets and more. And if you are a beginner or planning...

Read full article >

In the domain of Information Technology, there is always a lot to learn and implement. However, some technologies have a relatively higher demand than the rest of the others. So here are some popular IT courses for the present and upcoming future: Cloud Computing Cloud Computing is a computing technique which is used...

Read full article >

Java is the most famous programming language till date. 20 years is a big time for any programming language to survive and gain strength. Java has been proved to be one of the most reliable programming languages for networked computers. source:techcentral.com Java was developed to pertain over the Internet. Over...

Read full article >

Designed in a flexible and user-friendly demeanor, Java is the most commonly used programming language for the creation of web applications and platform. It allows developers to “write once, run anywhere” (WORA). It is general-purpose, a high-level programming language developed by Sun Microsystem. Initially known as an...

Read full article >

Looking for Java Training Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Java Training Classes?

The best tutors for Java Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Java Training with the Best Tutors

The best Tutors for Java Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more