Swagato Bhatta wrote:
Minhaj kaimkhani wrote:well as i said before a class can have another class(i.e. Inner class) that can be declared as static;
example:
in the above case Clazz is the most outer class.
Thank you
Jeff Verdegan wrote:
Abhishek Bose wrote:
Thanks a lot... but i am still confused with how its working
What are you confused about. It's a method. It gets called. And, as the docs say, it returns negative, 0, or positive, to indicate that s.songName is less than, equal to, or greater than this.songName. (Which, by the way, is backwards for how one normally implements a comparison, but maybe somebody is doing a reverse sort.)
So what's your confusion?
Viktor Kubinec wrote:First of all, you should follow java naming conventions ( class names should start with uppercase letter).
Second, your compareTo method implementation is not right (it is legal, but incorrect)
try this :
or this :
in compareTo method you should compare "this" object with s object. In your implementation you are comparing this object with itself, which makes no sense. To get a proper output you have to override toString method.
Buddhika Mawella wrote:When a java program is compiling there is nothing called heap or stack. Stack and heap only exist on runtime.
Buddhika Mawella wrote:There is nothing called 'loading' when compiling. Compiling a java program is just converting your human readable java code in to a machine readable language when interpreted by JVM.