Win a copy of Microservices in Action this week in the Web Services forum!

vipul John

Ranch Hand
+ Follow
since Oct 14, 2010
India
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
6
Given in last 30 days
1
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 weeks 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 weeks 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 weeks ago


source: https://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html

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 weeks 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 weeks 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 weeks 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.
7 months ago
Hi Linus,

Welcome to Java Ranch.
8 months ago
One of my favourite books in java. I have learnt very good programming by reading Effective Java Third Edition book. Thanks Joshua
8 months 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?
10 months 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.
10 months ago
You can use below link to download jar files and configure web.xml file.
http://www.mazong1123.com/use-jersey-2.0-without-maven/

To implement a jersey web service, just go through jersey documentation link:
https://repo1.maven.org/maven2/org/glassfish/jersey/jersey-documentation/2.5.1/jersey-documentation-2.5.1-user-guide.pdf

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