Skip to main content

Posts

Showing posts from March 9, 2019

Diff_Serialization&Externalization

*********************************************************************************************************************** The process of converting system representation to network representation is called an marshalling. The process of converting data from network representation to sysytem representation is called un marshalling. ************************************************************************************************************************ Serialization: ================ the process of seprating data from an object is called serialization. or -> The process of writing state of an object to a file is called Serialization. -> But strictly speaking, it is a process of converting an object from java supported form to either file supprted form      or network supported form or database supported form is called Serialization. -> By using FileOutputStream and ObjectOutputStream, we can achieve Serialization. It is meant for default Serialization. ...

Diff_Serialization&Externalization

*********************************************************************************************************************** The process of converting system representation to network representation is called an marshalling. The process of converting data from network representation to sysytem representation is called un marshalling. ************************************************************************************************************************ Serialization: ================ the process of seprating data from an object is called serialization. or -> The process of writing state of an object to a file is called Serialization. -> But strictly speaking, it is a process of converting an object from java supported form to either file supprted form      or network supported form or database supported form is called Serialization. -> By using FileOutputStream and ObjectOutputStream, we can achieve Serialization. It is meant for default Serialization. ...

Collection

1. How does HashMap work in Java? 2. What is the difference between poll() and remove() method of Queue interface? (answer) Though both  poll()  and  remove()  method from Queue is used to remove the object and returns the head of the queue, there is a subtle difference between them. If  Queue  is  empty()  then a call to  remove()  method will throw Exception, while a call to  poll()  method returns  null . By the way, exactly which element is removed from the queue depends upon queue's ordering policy and varies between different implementation, for example,  PriorityQueue  keeps the lowest element as per  Comparator  or  Comparable  at head position.  3. What is the difference between fail-fast and fail-safe Iterators? 5. What is the difference between Synchronized Collection and Concurrent Collection? ( answer ) Java 5 has added several new Concurrent Collection clas...

SynchronizedConcept

Synchronized keyword ========================================================================================================================= -> Synchronized modifier is applicable only for methods and blocks but not for classes and variables. -> If multiple threads are operating simultaneously on same java object then there may be a chance of data inconsistency problem. -> To overcome this problem we should go for synchronized. -> If a method or block declared as synchronized then at a time only one thread is allowed to operate method or block on the given object. -> So that we can resolve data inconsistency problem. -> The main advantage of synchronized keyword is we can overcome data inconsistency problems. -> But the main disadvantage is it increases waiting time of threads and creates performance problems. -> Hence if there is no specific requirement then it is never recommanded to use synchronized keyword. -> Synchronized method should co...

SOAPvsREST

SOAP vs REST Web Services ================================= 1. SOAP is a Protocol. Whereas Rest is an architectural style. 2. SOAP stands for Simple Object Access Protocol. Whereas Rest stands for REpresentational State Transfer. 3. SOAP can't use REST because it is a protocol. Whereas REST can use SOAP web services because it is a concept      and can use any protocol like HTTP, SOAP. 4. SOAP uses services interfaces to expose the business logic. Whereas REST uses URI to expose business logic. 5. JAX-WS is the java API for SOAP web services. Whereas JAX-RS is the java API for RESTful web services. 6. SOAP defines standards to be strictly followed. Whereas REST doesn't define too much standards like SOAP. 7. SOAP requires more bandwidth and resource than REST. Whereas REST requires less bandwidth and resource than SOAP. 8. SOAP defines its own security. Whereas RESTful web services inherits security measures from the underlying transport. 9. SOAP permits XML d...

Autowire

Autowiring ==============================================================\ When we declare a class as bean as part of spring bean configuration file,then IOC containe will not managed the dependency between the classes,until we have to provide the dependency between those classes.      But we dont want to manually provide the dependency rather we have to instruct the IOC to detect the dependenct and managed the injection. <bean id="motor" class="com.di.Motor" autowire="byName"> </bean> -> Configuring beans and their dependency is nothing but wiring. -> There are two types of wiring. 1. Explicit wiring, and 2. Autowiring(Implicit wiring). -> Autowiring feature of Spring f/w enables us to inject the object dependency implicitly. -> It internally uses setter or constructor injection. -> It requires the less code because we don't need to write the code to inject the dependency explicitly. -> Autowiring can'...

Architecture of Web-services

Architecture of Web services : 1.Must connected over the n/w 2.Tx/comm channel 3.protocol (Http) Diffrerence b/w Http 1.0 and Http 1.1 : 4.Standard Encoding format/comm language (ASCII,(TF 8(,16,32),CSV,Xml) Problems with ASCII,UTF,CSV Advantages of Xml: -We can write well defined symantics for the data -We can define the boundaries of the data easily     Hence everybody can understand and using this can performs the operations. -Interoperable Complete Architecture: -SOAP (Simple Object Access Protocol)/Binding Protocol/Application Specific Protocol/carrier of Payload. -WSDL (Web-Service Description Language) -UDDI Registry   (Universal Description Discovery And Integration)

WebServiceCompponent

Q What are the components of web service? Web Service Components: =========================== There are three major web service components. 1. SOAP--Simple Object Access Protocol 2. WSDL-Web Service Description language 3. UDDI--Universal Description, Discovery, and Integration 4.XML- Extensible Markup Language SOAP ================== -> SOAP is an acronym for Simple Object Access Protocol. -> SOAP is a XML-based protocol for accessing web services. -> SOAP is a W3C recommendation for communication between applications. -> SOAP is XML based, so it is platform independent and language independent. In other words, it can be used with Java, .Net or PHP language on any platform. WSDL ======================= -> WSDL is an acronym for Web Services Description Language. -> WSDL is a xml document containing information about web services such as method name, method parameter and how to access it. -> WSDL is a part of UDDI. It acts as a interface betwe...

Diff_Interface&Abstract-class

What is Interface: =================== -> The interface in java is a mechanism to achieve abstraction. -> There can be only abstract methods in the java interface not method body. -> It is used to achieve abstraction and multiple inheritance in Java. -> Java Interface also represents IS-A relationship. Why use Java interface?: ====================== 1. It is used to achieve abstraction. 2. By interface, we can support the functionality of multiple inheritance. 3. It can be used to achieve loose coupling. Abstraction:   (Security Purpose) =========== -> Highlighting set of services what we are offering and hiding implementation details is nothing but Abstraction. Example: ATM. -> Hiding internal details and showing functionality is known as abstraction. -> For example: phone call, we don't know the internal processing. -> In java, we use abstract class and interface to achieve abstraction. Interface ================= 1. If we don'...

Dependency Injection

What is Dependency Injection? ======================================= -> Dependency Injection (DI) is a design pattern that removes the dependency from the programming code so that it can be easy to manage and test the application. -> Dependency Injection makes our programming code loosely coupled. -> In such case we provide the information from the external source such as XML file. -> It makes our code loosely coupled and easier for testing. -> DI is all about objects and their dependencies. -> In Spring frameowork, Dependency Injection (DI) design pattern is used to define the object dependencies between each other. -> It is a process where objects are defining their dependencies and other objects work with them either constructor arguments or properties . -> There are 2 widely used types: 1. Setter Injection, and 2. Constructor Injection -> If we configure both setter injection and constructor injection on bean property the values given by sette...

Association Relationship

à 1. Association Relation Ship: à By using this ORM-mapping model we can resolve/solve the " Association Impedance mismatch " problem. à Association is 3-types 1.     Association[No owner and Life time is Independent] 2.     Aggregation[Owner and Life time is Independent] 3.     Composition[Owner and Life time is dependent] à Association and Aggregation is looks like same hence we will considered these are same in relational model hence in ORM we can map Association Relation in 2-ways. 1.     Association Mapping Model(Association or Aggregation) 2.     Component Mapping Model(Composition) 1. Association Mapping Model (Association or Aggregation): Ex: class Person {   private int personId;   private String firstNm;   private String lastNm;   private String gender;   private int age;   private Address address; } class Address {   priva...