Top 40 Java Web Services Interview Questions and Answers

Web services interview questions are mostly asked in Software development Positions. We have already shared the frequently asked core java interview questions and tricky java interview questions.
So  below are the answers to the frequently asked web services interview questions.


Q1  What are web services ?

According to oracle docs, web services can be defined as

Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). Web services provide a standard means of inter operating between software applications running on a variety of platforms and frameworks.

Main characteristics of the Web Services  are :

1. Interoperability
2. Extensibility
3. Machine processable descriptions.

for example in simple words , when we call somebody so the person dialing and calling is the client  application , while person receiving the call is server application and "hello" word is the protocol as similar to HTTP request .


Q2 What is the difference between SOA and a web service?

SOA (Service-Oriented Architecture) is an architectural pattern that makes possible for
services to interact with one another independently. 

Why String is final or immutable in Java with Example

Before going  into details as why String is final or immutable in java , first let us understand the meaning of the term "immutable".


What does immutable means?

According to our good buddy, “thefreedictionary”, immutable means “not capable or susceptible to change”.


Note : In java , if an object is immutable then it can not be changed after creation.




How Strings are immutable ?

The String Class

The String class represents a set of characters enclosed in a pair of double quotes (“”). All String literals in Java, such as "hello", are implemented as instances of the String class. 

Strings are immutable; their values cannot be changed after they have been created, while StringBuffers and StringBuilders supports mutable versions of the String object.

For example: 
     String str = "hello";  

is equivalent to:       
char ch[] = {'h', 'e', 'l', ‘l’, ‘o’};      
String str = new String(ch);