I have been wondering the real use of interface. please check the below code.  interface Animal {     public void eat();     public void travel(); }   public class MammalInt implements Animal{      public void eat(){         System.out.println("Mammal eats");     }      public void travel(){         System.out.println("Mammal travels");     }       public int noOfLegs(){         return 0;     }      public static void main(String args[]){         MammalInt m = new MammalInt();         m.eat();         m.travel();     } }    in the above code if i remove implements Animal from class declaration still the code works fine without any difference. So what is the actual use of interface. ?
I understand that they force you to implement methods and such but what I cant understand is why you would want to use them. Can anybody give me a good example or explanation on why I would want to implement this.
Update:   Once upon a time there was a feature called . Its goal was to help our most active users find the questions they can answer. &quot;New nav&quot; never made it out of beta and that beta only ever made it to Stack Overflow users. Several months ago we gave new nav a sad, but overdue burial. As we promised, we've been working on a replacement for new nav, and now it's time for us to start rolling it out. We're calling it custom question lists and we are really excited about its potential to help all users get at the questions that are most interesting to them. While we hope what we've built hits the mark for many of you who have requested a feature like this (e.g., , , , , , ), we know how difficult it is to make something complex simple. So, we are rolling this out in beta to gather feedback from you and iterate on it. (Don't worry, we promise to actually release it this time.) When it's live later you'll be able to opt-in to the beta by turning on a new account preference. This will enable the feature for Stack Overflow, Meta Stack Overflow, and Meta Stack Exchange. It will be available for all network sites when the beta period is over. Schedule for future improvements This feature will roll out in four phases:  Phase I: Filter and sort controls to let you modify a question list view (Julyish) Phase II: Saved custom lists (In progress, ETA November 2018) Phase III: Notifications on custom lists (December 2018) Phase IV: Final fixes and official release (January 2019)  Sneak peak Phase I: Filter and sorts We'll add filter and sort controls to question lists. This does two things:  Clarifies the definition of built-in views - Naming is hard and short names can't always describe what a view is showing you. By exposing the filter and sort controls it is more obvious. Introduces the ability to create new custom views - This won't be super useful until we add the ability to save the views to the UI (phase II). Until then you can bookmark the URL and get back to your views.  Question list with new controls   Views drop down   Filter   Sort   Phase II: Saved custom question lists In this phase we will add the ability to save your custom questions lists. Create custom list In our current design, a dialog will be pre-populated based on the filters and sorts you're currently using. Give it a name, confirm your options, and click save.  Accessing your saved lists When you save your custom lists they will show up in the &quot;More&quot; drop down for question list views. Additionally, you can add them to the left navigation bar for easy access (see image below).  Phase III: Notifications For phase III we'll enable indicators for when new items are available in a custom question list. When you pin a question list to the left nav you can see a dot on any list with new items.  Feedback welcome As usual, we're interested in your constructive feedback. This is a work in progress and, as mentioned, will be rolled out in phases. You can provide feedback on the concepts now based on the information in this post and provide feedback based on the working elements as they are released. How to fairly select a random number for a game without trusting a third party? Proving the inequality $\frac{n^k}{k^k}\leq\binom{n}{k}\leq\frac{n^k}{k!}$ involving binomial coefficient. What is the best way of proving inequalities including binomial coefficients in general? Lets look at this example:     $$\frac{n^k}{k^k}\leq\binom{n}{k}\leq\frac{n^k}{k!}$$   What I started with is:  $$\binom{n}{k}\frac{1}{n^k}\leq\frac{1}{k!}$$ $$\frac{n!}{k!(n-k)!}\frac{1}{n^k}\leq\frac{1}{k!}$$ $$\frac{(n-1)!}{(n-k)!n^{k-1}}\leq1$$ This is where I got stuck. How can I prove that is is lower than or equal to 1? Could you give me a hint? How can I animate the Restrict Visibility property of an object? I've been trying to create an animation where an object blinks on and off.   For example, I have a Cube and I set a keyframe on it's Restrict Visibility icon (the "eye" icon) with I, then I toggle off that "eye" so my cube doesn't show in the Viewport and again I press I to record that keyframe. Then, when I preview the animation in the Viewport, I see my cube appears and then disappears like I want, but when I render it, the cube does not disappear at all.  What am I doing wrong? Can my familiar use a Ring of Spell Storing? Can the familiar options from the Pact of the Chain warlock (quasit, imp, sprite, pseudodragon) attune with a ring of spell storing?  If so, can I cast a spell requiring concentration into the ring and then have the familiar maintain concentration on the spell? The spell was cast without words, simply a flick of the Death Eater's wand, and a 'streak of purple flame' that lanced across her chest. It was later mentioned that the spell was weakened because of the lack of a verbal component, but still 'did enough damage as it was'. She was in the infirmary healing from the damage for some time. What spell was this? Complete view of where the PATH variable is set in bash How to reinstall PulseAudio (Ubuntu 12.04) If i click on Ubuntu Software, it doesn't open. I have a fresh install of Ubuntu 20.04. I tried try to upgrade all packages, but it doesn't fix this problem.  If I try to run killall software-center there is no process with this name, and software-center returns command not found. If I try to reinstall it with apt I have these results:  $ sudo apt-get --purge --reinstall install software-center Reading package lists... Done Building dependency tree        Reading state information... Done Package oracle-java8-installer is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'software-center' has no installation candidate How did the house elves start serving wizards? How/Why/When did the house elves start serving wizards? I tried on my own to find the answer but I couldn't find anything relevant to my subject but I am bad at searching. For instance, does the compiler know to translate  string s = "test " + "this " + "function";   to  string s = "test this function";   and thus avoid the performance hit with the string concatenation? Will I still receive OTA updates after rooting my Nexus 5? I just wanna ask that after rooting Nexus 5 will I be receiving OTA updates by Google ? Or I'll have to install a custom ROM ? How to sort a Google Sheets Query by a custom ordering What is the correct JSON content type? I've been messing around with  for some time, just pushing it out as text and it hasn't hurt anybody (that I know of), but I'd like to start doing things properly.  I have seen so many purported "standards" for the JSON content type:  application/json application/x-javascript text/javascript text/x-javascript text/x-json   But which one is correct, or best? I gather that there are security and browser support issues varying between them.  I know there's a similar question, , but I'd like a slightly more targeted answer. Does it make sense to combine PCA and LDA? Assume I have a dataset for a supervised statistical classification task, e.g., via a Bayes' classifier. This dataset consists of 20 features and I want to boil it down to 2 features via dimensionality reduction techniques such as Principal Component Analysis (PCA) and/or Linear Discriminant Analysis (LDA).  Both techniques are projecting the data onto a smaller feature subspace: with PCA, I would find the directions (components) that maximize the variance in the dataset (without considering the class labels), and with LDA I would have the components that maximize the between-class separation.  Now, I am wondering if, how, and why these techniques can be combined and if it makes sense.  For example:   transforming the dataset via PCA and projecting it onto a new 2D subspace transforming (the already PCA-transformed) dataset via LDA for max. in-class separation   or    skipping the PCA step and using the top 2 components from a LDA.   or any other combination that makes sense. Is the graviton hypothetical? Number of genes required to sustain life Are there estimates of the minimum number of genes required to sustain life?   In what I mean by life here, I don't include viruses. Cannot remove any bluetooth device How do I debug when the system freezes or when it crashes back to login? I am fairly new to Ubuntu and I was wonder what a good way is to debug when something crashes?   For example: I installed 11.04 and the default media player banshee makes my laptop crash after a few minutes of playing music. Since the system completely freezes and there is not error message it's hard to find out what is wrong.  Second problem I have is that sometimes the system crashes to login. I am suspecting it to be a Chromium or Flash but I am not 100% sure.  So anybody got some tips on how to debug stuff like this? Interpretation of mean absolute scaled error (MASE)