1. Home >
  2. Apps >
  3. Groups >

Difference between Interface and Abstract class in Java?

Question asked by safiajen0055 in #Java on Nov 26, 2012
safiajen0055
safiajen0055 路 Nov 26, 2012
Rank D1 - MASTER
Hello Friends,

Please Help Me Guys!!
What is the difference between an Interface and an Abstract class in Java ? Posted in: #Java
Ankita Katdare
Ankita Katdare 路 Nov 26, 2012
Rank A1 - PRO
Check out the post #20 in this thread here -
https://www.crazyengineers.com/threads/doubt-in-java-programming.35897/page-2#post-126004
What exactly didn't you understand about these two terms? Please elaborate your question. 馃憤
Shuvojit Sarkar
Shuvojit Sarkar 路 Nov 27, 2012
Rank E2 - BEGINNER
I need an help ....
I am using a loop to take multiple char inputs and do any stuff with that char value in that loop ...
I am in a problem ... BufferedReader is skipping every second input ....
For Example If The Loop iterates 10 times ...
then it takes input on iteration no. 1,3,5,7 and 9.... Please Help ...
rahul69
rahul69 路 Nov 27, 2012
Rank B2 - LEADER
Shuvojit Sarkar Welcome to CE, regarding to the problem, kindly post the code snippet as it helps us understanding the problem better, 馃榾 Also avoid all Bold font. Also it is better to create a new thread in respective section rather than writing in an old thread meant for some other problem.
From the info u gave, I can suggest one quick fix i.e. use System.out.flush(); before buffer.readLine(); 馃憤 ,and if this does not works, then please provide code as it will help us giving exact solution. Good Luck!!
safiajen0055
safiajen0055 路 Dec 3, 2012
Rank D1 - MASTER
AbraKaDabra
Check out the post #20 in this thread here -
https://www.crazyengineers.com/community/threads/doubt-in-java-programming.35897/page-2#post-126004
What exactly didn't you understand about these two terms? Please elaborate your question. 馃憤
Thanks for sharing this link. You describe it very well.
I need only overview of these terms and i understand about these terms.
I hope you will help me if i need the Help about Java programming .
Ankita Katdare
Ankita Katdare 路 Dec 3, 2012
Rank A1 - PRO
safiajen0055
I hope you will help me if i need the Help about Java programming .
For sure. Keep posting here on CE and stick to CrazyEngineers Community. 馃憤 We are all here to help you if you ask specific, to-the-point questions.
Karshil Sheth
Karshil Sheth 路 Feb 12, 2020
Rank C2 - EXPERT

There are Main differences are:-

1) Interface is 100% abstract class and in it only behavior is defined.

2) Abstract class is not 100% abstract, it just defines the identity of class

3) 聽interface name{ //methods } syntax of Interface.

4) abstract classname{ //code };聽

More you can read on :- https://www.guru99.com/interface-vs-abstract-class-java.html聽

Mohana Chandra
Mohana Chandra 路 Feb 14, 2020
Rank C1 - EXPERT

Differences are:

  • Abstract classes allows 聽constructors,whereas the interfaces doesn't allow the constructors.
  • Data members in abstract class can be static or non-static .But in interfaces,data members are static and final by default.
  • Abstract classes are not purley abstract because they allow concrete methods too.Interfaces are purely abstract because it allows only abstract methods in it.
  • Abstract class cannot extend from more than one method.Interfaces can extend from interface to interface.
Durgesh Srivastava
Durgesh Srivastava 路 Feb 18, 2020
Rank C1 - EXPERT

Abstract Classes-

An abstract class can extend only one class or one abstract class at a time .

An abstract class can extend another abstract class .

In abstract class abstract method is used for extending.

An abstract class can have protected and public abstract methods聽

Interfaces Classes-

An interface can extend any number of interfaces at a time聽

An interface can only extend another interface聽

An interface can have only abstract methods.

聽In an interface keyword 鈥渁bstract鈥 is optional to declare a method as an abstract 聽

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up