Abhishek Bose

Greenhorn
+ Follow
since Dec 14, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Abhishek Bose

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




What if we declare a static class implementing a comparator<>?


Can we create an object of a static class?

[Edit - formatting]
12 years ago

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?




According to my understanding in the first cycle this.songName gets value fastcar and s.songName gets the value falltopieces and then they get compared?
12 years ago

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.





Thanks a lot... but i am still confused with how its working
12 years ago



I wrote this code but what is getting displayed is
[songs@addbf1, songs@42e816, songs@9304b1][songs@addbf1, songs@42e816, songs@9304b1]

Can somebody explain me why this is happening? Also in the comaprerTo method [return songName.compareTo(songName); falltopieces is comparing with falltopieces] its like comparing a song name with itself, Then what the use of compareTo()?


12 years ago
Hello EveryOne,

I am not clear with this HAs- A relationship in java....can anyone please explain me..... i request a detailed version of the explaination.....!
13 years ago
how are opcodes related to java..?
13 years ago
If a inner class is declared in the method of the outer class and it has a local variable then why it must be declared as Final...?
13 years ago
I have Read that java is secure because of its JVM that protects it..... what actually jvm does to make java secure....???
13 years ago

Buddhika Mawella wrote:When a java program is compiling there is nothing called heap or stack. Stack and heap only exist on runtime.



So that means each and every member in a java program gets on to the heap during runtime and not before..?
13 years ago

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.



i mean when it gets on to heap.....!
13 years ago
Static members are loaded at runtime or compile time.....??
13 years ago
what is embedded java.?
13 years ago
Can any how strings can be made mutuable.....?
13 years ago