vipul John

Ranch Hand
+ Follow
since Oct 14, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vipul John

I just read an article on reference types like strong, weak , soft and phantom references. I want to know, will the developers in real time use these reference types and in what kind of applications.
In my whole experience I haven't used them and also code review team ever mentioned about it while reviewing code.
2 years ago
Local variables, in your case 'method' should be initialized with a value mandatory. Instance variables, if not initialized takes default values, but local variables don't.
2 years ago

salvin francis wrote:Default methods allow you to append more methods to your interface without breaking current systems.

providing default implementation is abstract class job, right?

My question is , are they doing abstract class job?  I understand they are introduced for Java 8 backward compatibility.
But going forward, how do they impact design of interfaces and abstract classes.
2 years ago


JavaTutorials wrote:Default methods enable you to add new functionality to the interfaces of your libraries and ensure binary compatibility with code written for older versions of those interfaces.

I assume the word in bold is backward.
2 years ago
Also, abstract classes define default behavior and implementing classes define specialized behavior. With the default methods in interfaces, how much does it impact interface, abstract class and specialized classes design.
2 years ago
I am reading an article on default methods in interface. I want to understand when to use abstract classes and interfaces.

The abstract class can define constructors. They are more structured and can have a state associated with them. While in contrast, default method can be implemented only in the terms of invoking other interface methods, with no reference to a particular implementation's state.

I did not understand the default method difference explained. Could any one help me understand.

Please also let me know when to use abstract classes and default methods in interfaces.
2 years ago
Hi All,

OCAJP - 1 book assessment test has below program. I did not understand how could parent access its private method when parent reference instantiated child object.

ouput is deer childCH false.

I am expecting deer childCH true. According to run-time polymorphism, child class hasHorns has to be invoked, right? Please let me know. Thanks.
Welcome Julien Vehent to code ranch.
3 years ago
One of my favourite books in java. I have learnt very good programming by reading Effective Java Third Edition book. Thanks Joshua
3 years ago

Kathir jeyap wrote:
I used the same code...However 500 error is returned and the page got redirected to the error page

I want the same page or window or dialog should be retained..

Please advise.

Why 500 is returned. Could you post the code you've written or the exception that is thrown?
3 years ago
you can use ModelAndView object. set the error message  and return ModelAndView object as response.

Please check below code. It helps.

write this piece of code inside @ControllerAdvice annotation class.
3 years ago
You can use below link to download jar files and configure web.xml file.

To implement a jersey web service, just go through jersey documentation link:

If you still get into problems, post your issue with all your findings. Thanks.
3 years ago