3:I[39275,[],""]
5:I[61343,[],""]
6:I[23053,["7699","static/chunks/8e1d74a4-5fcc24cf3a9fd8c2.js","7240","static/chunks/53c13509-baa86b522e6ae78c.js","4740","static/chunks/4740-14bdf05e7ce04a11.js","9617","static/chunks/9617-544346a1cd0024b4.js","3185","static/chunks/app/layout-8c4bc5784f5090d9.js"],"StateProvider"]
7:I[19593,["7699","static/chunks/8e1d74a4-5fcc24cf3a9fd8c2.js","7240","static/chunks/53c13509-baa86b522e6ae78c.js","4740","static/chunks/4740-14bdf05e7ce04a11.js","9617","static/chunks/9617-544346a1cd0024b4.js","3185","static/chunks/app/layout-8c4bc5784f5090d9.js"],""]
8:I[18709,["7699","static/chunks/8e1d74a4-5fcc24cf3a9fd8c2.js","5706","static/chunks/9c4e2130-08078aeb5700c43b.js","5505","static/chunks/385cb88d-fd2f37c33b8aa92c.js","5452","static/chunks/5e22fd23-9bf9fa71e7554411.js","9956","static/chunks/ee560e2c-f551c028fd538293.js","4740","static/chunks/4740-14bdf05e7ce04a11.js","6648","static/chunks/6648-3bc9d66179346fb0.js","9160","static/chunks/app/not-found-5850ce7843ba4d5a.js"],"default"]
9:I[45723,["7699","static/chunks/8e1d74a4-5fcc24cf3a9fd8c2.js","7240","static/chunks/53c13509-baa86b522e6ae78c.js","4740","static/chunks/4740-14bdf05e7ce04a11.js","9617","static/chunks/9617-544346a1cd0024b4.js","3185","static/chunks/app/layout-8c4bc5784f5090d9.js"],"default"]
4:["all","core-java","c"]
0:["79z6y6ppLce0GndJRjYzJ",[[["",{"children":[["all","core-java","c"],{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":[["all","core-java","c"],{"children":["__PAGE__",{},[["$L1","$L2"],null],null]},["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children","$4","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined","styles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/402d889fee29bde2.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/0ff6cecb1d0e96f8.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","2",{"rel":"stylesheet","href":"/_next/static/css/cb4e98a4c2dc4d80.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","3",{"rel":"stylesheet","href":"/_next/static/css/a246b44e33111fd9.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","4",{"rel":"stylesheet","href":"/_next/static/css/9d9d0f6a85930e46.css","precedence":"next","crossOrigin":"$undefined"}]]}],null]},[["$","html",null,{"lang":"en","children":["$","body",null,{"children":["$","$L6",null,{"children":[["$","$L7",null,{}],["$","$L3",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":["$","$L8",null,{}],"notFoundStyles":[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/cb4e98a4c2dc4d80.css","precedence":"next","crossOrigin":"$undefined"}]],"styles":null}],["$","$L9",null,{}]]}]}]}],null],null],[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/0cc2495744a38244.css","precedence":"next","crossOrigin":"$undefined"}]],"$La"]]]]
b:I[30043,["7699","static/chunks/8e1d74a4-5fcc24cf3a9fd8c2.js","5706","static/chunks/9c4e2130-08078aeb5700c43b.js","5505","static/chunks/385cb88d-fd2f37c33b8aa92c.js","5452","static/chunks/5e22fd23-9bf9fa71e7554411.js","9956","static/chunks/ee560e2c-f551c028fd538293.js","7240","static/chunks/53c13509-baa86b522e6ae78c.js","6051","static/chunks/795d4814-d7614a20709c27af.js","614","static/chunks/3d47b92a-f2bb54912083012c.js","9212","static/chunks/59650de3-13cfd2620b7240d2.js","522","static/chunks/94730671-a8ad9eca65504500.js","7675","static/chunks/b563f954-501d993050fd0717.js","1994","static/chunks/e34aaff9-cd556a7ee1a90c03.js","6990","static/chunks/13b76428-5a68792917164904.js","5957","static/chunks/30a37ab2-a5fc2d8864b3152b.js","6844","static/chunks/f25cdb8d-30c837856fb6d42d.js","7259","static/chunks/479ba886-8536ff4966e1aaf8.js","4740","static/chunks/4740-14bdf05e7ce04a11.js","6648","static/chunks/6648-3bc9d66179346fb0.js","4349","static/chunks/4349-c8f0646a83cc4179.js","4791","static/chunks/4791-6c93b9aca8a9f315.js","5225","static/chunks/5225-dc21c87d99338f19.js","9293","static/chunks/9293-d1b040d0324d0d5a.js","5919","static/chunks/5919-545104f05818203e.js","1413","static/chunks/1413-986ad1f4cd2d661e.js","2499","static/chunks/2499-61bd3b514e9c4cb8.js","4175","static/chunks/4175-fb05509a4e1790ec.js","5653","static/chunks/app/%5B...all%5D/page-f1bbbeae9a681a62.js"],"default"]
c:T9c6,<ul>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#java-swing"><span style="font-weight: 400;">What is Java Swing?</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#benefits-using-java-swing"><span style="font-weight: 400;">Benefits of Java Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#how-to-use-java-swing"><span style="font-weight: 400;">Using Java Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#features-of-java-swing"><span style="font-weight: 400;">Features of Java Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#common-java-swing-components"><span style="font-weight: 400;">Common Java Swing Components</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#advantages-of-swing"><span style="font-weight: 400;">Advantages of Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#create-a-jframe-in-java"><span style="font-weight: 400;">Steps to create JFrame in Java</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#container-class"><span style="font-weight: 400;">Container Class</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#use-of-jbutton-classes"><span style="font-weight: 400;">J button Classes</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#purpose-of-layout-manager"><span style="font-weight: 400;">Purpose of Layout Manager</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#about-mvc-connection"><span style="font-weight: 400;">MVC Connection</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #000000;"><a style="color: #000000;" href="#mvc-architecture"><span style="font-weight: 400;">MVC Architecture</span></a></span></li>
</ul>d:T4a8e,<p><span style="font-weight: 400;">Swing is the principal GUI toolkit for the Java programming language. It's part of the Java Foundation Classes API, which offers a graphical user interface (GUI) for Java applications.</span></p>
<p><span style="font-weight: 400;">Building efficient GUI apps get easy with all the components that come with a swing in Java. Java programming language is structured programming, and with the rising demand, it is essential to learn all Java programming fundamentals. This article addresses swing in Java and the Java swing class hierarchy.</span></p>
<p><span style="font-weight: 400;">Swing is a library in the Java Foundation Classes (JFC) that expands on the abstract window toolkit (AWT) and provides enhanced functionality and additional UI elements. Extended components have top-notch event handling and drag-and-drop capabilities &mdash; introducing java swing &mdash; introducing the significance of the swing java tutorial.</span></p>
<p><span style="font-weight: 400;">Swing is included in the standard Java distribution and features about four times as many User Interface (UI) components as AWT. The AWT is a constrained implementation that is not nearly capable of supplying the components necessary for constructing the complex GUIs that are required in today's commercial applications. It is because the needs for today's application <span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/working-windows-programming-gui-programming-c-net" target="_blank">GUIs</a></span> have changed.</span></p>
<p><span style="font-weight: 400;">When compared to the resources offered by Swing, the AWT component set is plagued with quite a few flaws and uses up a significant amount of the system's available resources. Programmers that create graphical user interfaces for commercial applications began to show much interest in its Classes.</span></p>
<ol>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Swing is available for use in creating GUIs.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Swing may use to develop the graphical user interfaces of server-side and client-side programs.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">The original code for the Swing framework wrote entirely in Java.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">The Abstract Windowing Toolkit includes the Swing library (Abstract Window Toolkit).&nbsp;</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Swing allows for a more customizable and flexible user experience and access to more robust building blocks.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Swing components in Java may run on any supported platform and are very efficient.</span></li>
</ol>
<table style="border-collapse: collapse; width: 100.017%; height: 120px;" border="1px" cellpadding="10">
<tbody>
<tr>
<td style="width: 98.3494%;">
<h3><strong>Table of Contents</strong></h3>
<ul>
<li style="font-weight: 400;" aria-level="1"><a href="#java-swing"><span style="font-weight: 400;"><span style="color: #236fa1;">What is Java Swing?</span></span></a></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#benefits-using-java-swing"><span style="font-weight: 400;">Benefits of Java Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#how-to-use-java-swing"><span style="font-weight: 400;">Using Java Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#features-of-java-swing"><span style="font-weight: 400;">Features of Java Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#common-java-swing-components"><span style="font-weight: 400;">Common Java Swing Components</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#advantages-of-swing"><span style="font-weight: 400;">Advantages of Swing</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#create-a-jframe-in-java"><span style="font-weight: 400;">Steps to create JFrame in Java</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#container-class"><span style="font-weight: 400;">Container Class</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#use-of-jbutton-classes"><span style="font-weight: 400;">J button Classes</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#purpose-of-layout-manager"><span style="font-weight: 400;">Purpose of Layout Manager</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#about-mvc-connection"><span style="font-weight: 400;">MVC Connection</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#mvc-architecture"><span style="font-weight: 400;">MVC Architecture</span></a></span></li>
</ul>
</td>
</tr>
</tbody>
</table>
<h2><a id="java-swing"></a><span style="color: #e67e23; font-size: 24px;">What is Java Swing?</span></h2>
<p><span style="font-weight: 400;">Java Swing is a graphical user interface toolkit part of the Java Foundation Class (JFC). It is used to create Java-based applications that run various platforms, including Windows, MAC OS, and Linux. Swing provides a rich set of widgets, including buttons, labels, trees, and tables.</span></p>
<h3><a id="benefits-using-java-swing"></a><span style="color: #e67e23; font-size: 20px;">Benefits of using java swing</span></h3>
<ul>
<li><span style="font-weight: 400;">Swing is a platform-independent, &ldquo;model-view-controller&rdquo; Framework for java, which is also the primary GUI toolkit for the java platform.</span></li>
<li><span style="font-weight: 400;">Swing provides rich widgets to build sophisticated user interfaces.<br /></span></li>
<li><span style="font-weight: 400;">Swing also provides a pluggable look-and-feel architecture. It allows applications to have a consistent look and feel across platforms.<br /></span></li>
<li><span style="font-weight: 400;">Swing is designed to provide a lightweight component architecture. It results in a smaller footprint and improved performance.</span></li>
</ul>
<h3><a id="how-to-use-java-swing"></a><span style="color: #e67e23; font-size: 20px;">How to use Java Swing</span></h3>
<p><span style="font-weight: 400;">It would be best if you had a basic understanding of java before using Java Swing. It includes understanding how to create and compile Java programs using the Java Program Kit (JDK). You should also be familiar with the swing class hierarchy. In addition to the core swing classes, you must import the package to handle events in swing components.</span></p>
<p><span style="font-weight: 400;">Java Swing is used to developing graphical user interfaces and other applications. Swing is a component-based framework that includes a rich set of widgets, such as buttons, labels, and text fields. It also provides a set of layout managers that allow you to control the size and position of components on a window or panel.</span></p>
<p><span style="font-weight: 400;">In addition, Swing provides a set of graphics and utility classes that make it easy to create and manipulate images, fonts, colors, and other graphical objects.</span></p>
<p><span style="font-weight: 400;">Swing applications are event-driven. Event&ndash;handling code is generally placed in a separate class, called an event listener, registered with the component that generates the events. When an event occurs, the event listener is notified and can take appropriate action.</span></p>
<p><span style="font-weight: 400;">Swing is platform-independent. The same code on one platform will run on any other platform that supports java. It makes it possible to write once and run anywhere.</span></p>
<p><span style="font-weight: 400;">Swing is also extensible. Developers can create their custom components and add them to the Swing toolkit.</span></p>
<table style="border-collapse: collapse; width: 100.017%; height: 44.0374px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 44.0374px;">
<td style="width: 98.3494%; text-align: center; height: 44.0374px;"><em>Want to acquire industry skills and gain complete knowledge of Java? Enroll in Instructor-Led live <span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/core-java-training" target="_blank"><strong>Core Java Training</strong></a></span> to become Job Ready!</em></td>
</tr>
</tbody>
</table>
<h3><a id="features-of-java-swing"></a><span style="color: #e67e23; font-size: 20px;">Features of Java Swing</span></h3>
<ul>
<li><span style="font-weight: 400;">Pluggable look and feel.</span></li>
<li><span style="font-weight: 400;">Uses MVC architecture.</span></li>
<li>Lightweight components.</li>
<li>Platform Independent.</li>
<li>Advance Features such as JTrappedPane, JTable, JScollPane etc.</li>
<li>The GUI of a Java app that uses Swing components is independent of the operating system the app executes since Java deploys any client system.</li>
</ul>
<h3><span style="color: #e67e23; font-size: 20px;"><strong><a id="common-java-swing-components" style="color: #e67e23;"></a>Common java swing components</strong></span></h3>
<p><span style="font-weight: 400;">Java Swing is used to develop graphical user interfaces (GUIs) and other applications. Swing is a component-based framework that includes a rich set of widgets, such as buttons, labels, text fields, combo boxes, radio buttons, sliders, scroll panes, toolbars, progress bars, text areas, and tabbed panes.</span></p>
<p><span style="font-weight: 400;">It also provides a set of layout managers that allow you to control the size and position of components on a window or panel. In addition, Swing provides a set of graphics and utility classes that make it easy to create and manipulate images, fonts, colors, and other graphical objects.</span></p>
<table style="border-collapse: collapse; width: 100.017%; height: 47.0374px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 47.0374px;">
<td style="width: 98.3494%; height: 47.0374px; text-align: center;">Also read: <a href="https://tekslate.com/java-regular-expressions-in-java" target="_blank"><span style="color: #236fa1;"><em><strong>Java Regular Expressions</strong></em></span></a></td>
</tr>
</tbody>
</table>
<h3><a id="advantages-of-swing"></a><span style="color: #e67e23; font-size: 20px;">Advantages of Java Swing</span></h3>
<p><span style="font-weight: 400;">The advantages are as follows:</span></p>
<ul>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Swing components mainly vary in terms of visual style and user interface, depending on the package.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Double buffering is a primary feature of Java Swing.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">The primary adaptability comes from its usage of MVC design principles, which ensure a wide range of possible user interfaces.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">It's designed to function identically to AWT's native components and even has a few extras thrown in for good measure.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">All the new parts are a part of the swing by default, so debugging is easy.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">The software and its constituent parts are cross-platform.</span></li>
<li style="font-weight: 400;" aria-level="1"><span style="font-weight: 400;">Lightweight is so named because it uses fewer resources than AWT, its primary competitor.</span></li>
</ul>
<h3><a id="create-a-jframe-in-java"></a><span style="color: #e67e23; font-size: 20px;">Short Way to Create a JFrame in Java</span></h3>
<ul>
<li><span style="font-weight: 400;">By instantiating Jframe Class.</span></li>
<li><span style="font-weight: 400;">By Extending the JFrame class.</span></li>
</ul>
<h3><span style="color: #e67e23; font-size: 20px;"><strong><a id="container-class" style="color: #e67e23;"></a></strong>Container Class</span></h3>
<p><span style="font-weight: 400;">A container class is any class that contains other components. At least one container class is required when developing a GUI application.</span></p>
<p><span style="font-weight: 400;">Generally speaking, there are three distinct categories of container classes:</span></p>
<ol style="list-style-type: lower-alpha;">
<li><span style="font-weight: 400;">Panel - A tool for arranging windowed elements.</span></li>
<li><span style="font-weight: 400;">Frame- A fully operational Window with tabs, icons, and titles is a Frame.</span></li>
<li><span style="font-weight: 400;">Dialog - A dialogue box appears, similar to a pop-up window but with limited functionality compared to the frame.</span></li>
</ol>
<h3><span style="color: #e67e23; font-size: 20px;"><strong><a id="use-of-jbutton-classes" style="color: #e67e23;"></a></strong>Use of JButton classes</span></h3>
<p><span style="font-weight: 400;">It is used to make a button with a label. When the button is pushed, something will happen because of the ActionListener. It comes from the AbstractButton class and works on any platform.</span></p>
<h3><a id="purpose-of-layout-manager"></a><span style="color: #e67e23; font-size: 20px;">Purpose of a layout manager</span></h3>
<p><span style="font-weight: 400;">To arrange the components inside a container, we use the layout manager. There are several layout managers:</span></p>
<ol style="list-style-type: lower-alpha;">
<li><span style="font-weight: 400;">Border layout.</span></li>
<li><span style="font-weight: 400;">Flow Layout.</span></li>
<li><span style="font-weight: 400;">Grid Bag layout.</span></li>
</ol>
<p style="text-align: right;"><span style="font-weight: 400;">Checkout:<a href="https://tekslate.com/java-arraylist-in-java" target="_blank"><span style="color: #236fa1;"><em><strong>[Arraylist in Java]</strong></em></span></a><br /></span></p>
<h3><a id="mvc-connection"></a><span style="color: #e67e23; font-size: 20px;">About MVC connection</span></h3>
<p><span style="font-weight: 400;">1) A visual component is usually made up of three different parts:</span></p>
<ol style="list-style-type: lower-alpha;">
<li><span style="font-weight: 400;">The appearance of the component when rendered on the screen.</span></li>
<li><span style="font-weight: 400;">The process in which the component responds to the user.</span></li>
<li><span style="font-weight: 400;">The component's related state information.</span></li>
</ol>
<p><span style="font-weight: 400;">2) Model-view-controller, or MVC for short, is a component architecture that has stood the test of time and has shown to be incredibly successful.</span></p>
<ol style="list-style-type: lower-alpha;">
<li><span style="font-weight: 400;">In MVC technology, the model is the same as the component's state information.</span></li>
<li><span style="font-weight: 400;">The view controls how the component looks on the screen, including any parts of the idea that depending on the model's current state.</span></li>
<li><span style="font-weight: 400;">The controller tells the part how to respond to the user.</span></li>
</ol>
<p><span style="font-weight: 400;">3) As detailed below, even the most basic swing parts offer advantages over their AWT counterparts.</span></p>
<ol style="list-style-type: lower-alpha;">
<li><span style="font-weight: 400;">Swing buttons and labels can either display pictures instead of text or both text and images simultaneously.</span></li>
<li><span style="font-weight: 400;">The bounds of the majority of swing components are simply modifiable.</span></li>
<li><span style="font-weight: 400;">It is not required that the components of swings be rectangular.</span></li>
<li><span style="font-weight: 400;">The most recent iterations of aggressive technology, like screen readers, can effortlessly extract data from swing components.</span></li>
</ol>
<h3><span style="color: #e67e23; font-size: 20px;"><a id="mvc-architecture"></a>MVC Architecture</span></h3>
<p><span style="font-weight: 400;">In the following manner, the Swing API architecture adheres to the loosely based MVC architecture.</span></p>
<ol>
<li><span style="font-weight: 400;">Model represents component&rsquo;s data.</span></li>
<li><span style="font-weight: 400;">View represents a visual representation of the component&rsquo;s data.</span></li>
<li><span style="font-weight: 400;">Controller takes the input from the user on the view and reflects the changes in the component&rsquo;s data.</span></li>
<li><span style="font-weight: 400;">Swing component has a Model as a separate element, while the view and controller parts are clubbed in the user interface elements.</span></li>
</ol>
<p>&nbsp;</p>
<h3><span style="color: #e67e23;"><strong>Conclusion:</strong></span></h3>
<p><span style="font-weight: 400;">Java is a popular programming language used to develop desktop and web applications. It is one of the most popular programming languages that is used today. Java programming language is a multi-paradigm programming language. Java is a programming language used to develop applications in different programming paradigms. It supports procedural programming and functional programming paradigms as well.</span></p>
<p><span style="font-weight: 400;">You can create a desktop-style application with the help of Java Swing. Creating desktop&ndash;style applications is quite similar to creating a web application, but in this case, you will have to build a desktop-style application with the help of a swing toolkit.</span></p>
<p><span style="font-weight: 400;">This article aims to show how to create a simple desktop-style application with the help of the Swing Toolkit. The next step is creating an application with a single JFrame containing an image and text messages. We will use JFrame as a container for our application.&nbsp;</span></p>
<p><span style="font-weight: 400;">The only difference between this and a typical web application is that we will build it on the desktop instead of on the web.</span></p>e:T4a1e,<p><span style="font-weight: 400;">In Java, a Stream is a series of data from various sources, including lists, arrays, sets, and other collections. Unlike collections, which must gather all the values before beginning processing, streams can do so asynchronously. The stream can be thought of as a pipeline in which data is processed as it is needed. This article compiles all of the blog posts covering the basics of the Jave Stream API and associated topics.</span></p>
<p><span style="font-weight: 400;">We all have heard the term java. It is a programming language or, in other terms, an object-oriented programming language and software platform. It is used in billions of devices, consoles, games, and many more. Learning Java is helpful in this century; as we discussed, many software use java as a programming language and even for designing games we all love and enjoy playing.</span></p>
<p><span style="font-weight: 400;">One of Java 8's most notable additions was support for streams. This in-depth Java stream tutorial serves as an introduction, and it will cover a wide range of features made possible by streams, emphasizing concrete, real-world applications. Data is never stored in a stream, so it cannot be considered a data structure. And it never changes the original data sources, either.</span></p>
<table style="border-collapse: collapse; width: 100.017%; height: 120px;" border="1px" cellpadding="10">
<tbody>
<tr>
<td style="width: 100%;">
<h3>Java Stream Tutorial - Table of Contents</h3>
<ul>
<li style="font-weight: 400;" aria-level="1"><a href="#why-java-stream"><span style="font-weight: 400;"><span style="color: #236fa1;">Why Javastream?</span></span></a></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#java-stream-operations"><span style="font-weight: 400;">JavaStream Operations</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#method-types-and-pipelines"><span style="font-weight: 400;">Method types and pipelines</span></a></span></li>
<li style="font-weight: 400;" aria-level="1"><span style="color: #236fa1;"><a style="color: #236fa1;" href="#lazy-evaluation"><span style="font-weight: 400;">Lazy evaluation</span></a></span></li>
</ul>
</td>
</tr>
</tbody>
</table>
<h2><span style="color: #e67e23;"><strong><a id="why-java-stream" style="color: #e67e23;"></a>Why Java Stream?</strong></span></h2>
<p><span style="font-weight: 400;">Java streams enable us with functional-style operations on streams of elements. A stream is just an abstraction of a non-mutable collection of functions applied in some order to the data. A stream is not a collection where you can easily store elements.</span></p>
<p><span style="font-weight: 400;">Functionality is managed via a Java component. It is made feasible by java.util.stream, which allows for functional-style operations on stream items that are analogous to the map-reduce transformations performed on collections. The descriptions will be easier to grasp because of the visuals.</span></p>
<p><span style="font-weight: 400;">Now, let's look at a few easy and simple examples of how to create and use streams before we get into terms and core ideas.</span></p>
<p><strong>An example is displayed here.&nbsp;</strong></p>
<pre class="language-java"><code>private static Employee[] arrayOfEmps = {

    new Employee(1, "Jeff Bezos", 100.0), 

    new Employee(2, "Bill Gates", 200.0), 

    new Employee(3, "Mark Zuckerberg," 300.0)

};

Stream.of(arrayOfEmps);</code></pre>
<p><strong>Note:</strong><span style="font-weight: 400;"> In Java 8, the Collection interface now contains a new stream() function.</span></p>
<p><span style="font-weight: 400;">We may also create a stream for any individual object using stream.of():</span></p>
<p><span style="font-weight: 400;">Or we can use stream.builder():</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>Stream.Builder&lt;Employee&gt; empStreamBuilder = Stream.builder();

empStreamBuilder.accept(arrayOfEmps[0]);

empStreamBuilder.accept(arrayOfEmps[1]);

empStreamBuilder.accept(arrayOfEmps[2]);

Stream&lt;Employee&gt; empStream = empStreamBuilder.build();</code></pre>
<table style="border-collapse: collapse; width: 100.012%; height: 54.0374px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 54.0374px;">
<td style="width: 98.4238%; height: 54.0374px; text-align: center;"><em>Want to acquire industry skills and gain complete knowledge of Java? Enroll in Instructor-Led live <strong><span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/core-java-training" target="_blank">Core Java Training</a></span></strong> to become Job Ready!</em></td>
</tr>
</tbody>
</table>
<h2><span style="color: #e67e23;"><strong><a id="java-stream-operations"></a>Java stream operations</strong></span></h2>
<p><span style="font-weight: 400;">Let's look at some popular applications of the new stream language and specific operations we may execute on it and with its help.</span></p>
<p><strong>forEach</strong></p>
<p><span style="font-weight: 400;">It is one of the most simple and joint operations; it loops over stream elements. The method is so standard that it is introduced directly in Iterable, Map, and many more.</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>@Test

public void whenIncrementSalaryForEachEmployee_thenApplyNewSalary() 

{    

    empList.stream().forEach(e -&gt; e.salaryIncrement(10.0));

     assertThat(empList, contains(

      hasProperty("salary", equalTo(110000.0)),

      hasProperty("salary", equalTo(220000.0)),

      hasProperty("salary", equalTo(330000.0))

    ));

}</code></pre>
<p><span style="font-weight: 400;">If you use the forEach() function, the stream pipeline will be considered consumed and unusable once the procedure has finished.</span></p>
<table style="border-collapse: collapse; width: 100.012%; height: 30.0374px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 30.0374px;">
<td style="width: 98.4238%; text-align: center; height: 30.0374px;"><em>Related article:</em> <span style="color: #236fa1;"><em><strong><a style="color: #236fa1;" href="https://tekslate.com/exception-handling-in-java" target="_blank">Exception Handling in java</a></strong></em></span></td>
</tr>
</tbody>
</table>
<p><strong>map</strong></p>
<p><span style="font-weight: 400;">A new stream is created by the map() function when a function is applied to each element of the previous stream, also known as the "original stream." The new stream could branch off into a few different directions.</span></p>
<p><span style="font-weight: 400;">The following code snippet shows how to transform a sequence of Integers into an equal sequence of Employees.</span></p>
<pre class="language-java"><code>@Test

public void whenMapIdToEmployees_thenGetEmployeeStream() 

{

    Integer[] empIds = { 1, 2, 3 };

    List&lt;Employee&gt; employees = Stream.of(empIds)

      .map(employeeRepository::findById)

      .collect(Collectors.toList());

    assertEquals(employees.size(), empIds.length);

}</code></pre>
<p><span style="font-weight: 400;">In this section, we convert an array of employee IDs into an integer stream. Because each integer is given to the function employeeRepository::findById(), which returns the object representing the relevant employee, an employee stream is essentially created.</span></p>
<p><strong>collect</strong></p>
<p><span style="font-weight: 400;">We got a glimpse of how the collection works in the example mentioned earlier; it is one of the most common ways to get stuff or works out of the stream when we have done or completed the processing:&nbsp;</span></p>
<pre class="language-java"><code>@Test

public void whenCollectStreamToList_thenGetList() 

{

    List&lt;Employee&gt; employees = empList.stream().collect(Collectors.toList());  

    assertEquals(empList, employees);

}</code></pre>
<p><span style="font-weight: 400;">The collect() method applies mutable fold operations on the data items kept in the Stream instance. These processes include repackaging elements to various data structures and applying further logic, concatenating them, and so on.</span></p>
<p><span style="font-weight: 400;">The implementation of the Collector interface supplies the strategy that should use for this operation. In the preceding illustration, we gathered all of the Stream items into a List instance with the help of the toList collector.</span></p>
<table style="border-collapse: collapse; width: 100.012%; height: 30.035px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 30.035px;">
<td style="width: 98.4238%; text-align: center; height: 30.035px;">Related article: <span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/java-interface-in-java" target="_blank"><em><strong>Interface in Java</strong></em></a></span></td>
</tr>
</tbody>
</table>
<p><strong>filter</strong></p>
<p><span style="font-weight: 400;">filter() produces a new stream that consists of a component of the original stream which passes a given test</span></p>
<p><strong>Example:</strong></p>
<p>&nbsp;</p>
<pre class="language-java"><code>@Test

public void whenFilterEmployees_thenGetFilteredStream() 

{

    Integer[] empIds = { 1, 2, 3, 4,5 };

    List&lt;Employee&gt; employees = Stream.of(empIds)

      .map(employeeRepository::findById)

      .filter(e -&gt; e != null)

      .filter(e -&gt; e.getSalary() &gt; 200000)

      .collect(Collectors.toList());

   assertEquals(Arrays.asList(arrayOfEmps[2]), employees);

}</code></pre>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">In the above example, null references for invalid employee ids are filtered away before a second filter is used to retain only workers with wages over a specified threshold.</span></p>
<p><strong>findFirst</strong></p>
<p><span style="font-weight: 400;">It returns an optional entry in the stream, and the options can be empty.</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>@Test

public void whenFindFirst_thenGetFirstEmployeeInStream() 

{

    Integer[] empIds = { 1, 2, 3, 4,5 };

    Employee employee = Stream.of(empIds)

      .map(employeeRepository::findById)

      .filter(e -&gt; e != null)

      .filter(e -&gt; e.getSalary() &gt; 100000)

      .findFirst()

      .orElse(null);

    assertEquals(employee.getSalary(), new Double(200000));

}</code></pre>
<p><span style="font-weight: 400;">This section returns the first employee whose annual compensation is higher than 100,000 dollars. If there is no such employee, it will return the value null.</span></p>
<p style="text-align: right;"><strong>Checkout: [<a href="https://tekslate.com/polymorphism-in-java" target="_blank"><span style="color: #236fa1;"><em>Polymorphism in Java</em></span></a>]</strong></p>
<p><strong>toArray</strong></p>
<p><span style="font-weight: 400;">We learned how to collect() works to get out of the stream. If there is a need to get out of the stream, we just need to use Array():</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>@Test

public void whenStreamToArray_thenGetArray() 

{

    Employee[] employees = empList.stream().toArray(Employee[]::new);

    assertThat(empList.toArray(), equalTo(employees));

}</code></pre>
<p><strong>flatMap</strong></p>
<p><span style="font-weight: 400;">flatMap holds a bit complex data structures like stream &lt;List&lt;String&gt;&gt;</span></p>
<p><strong>Example&nbsp;</strong></p>
<pre class="language-java"><code>@Test

public void whenFlatMapEmployeeNames_thenGetNameStream() 

{

    List&lt;List&lt;String&gt;&gt; namesNested = Arrays.asList( 

      Arrays.asList("Jeff", "Bezos"), 

      Arrays.asList("Bill", "Gates"), 

      Arrays.asList("Mark", "Zuckerberg"));

    List&lt;String&gt; namesFlatStream = namesNested.stream()

      .flatMap(Collection::stream)

      .collect(Collectors.toList());

    assertEquals(namesFlatStream.size(), namesNested.size() * 2);

}</code></pre>
<p><strong>Note: </strong><span style="font-weight: 400;">notice how we were able to change or convert Stream&lt;List&lt;String&gt;&gt; to a more straightforward Stream&lt;String&gt; &ndash; using the flatMap() API.</span></p>
<p><span style="font-weight: 400;">peek</span></p>
<p><span style="font-weight: 400;">ForEach(), a terminal operation, was demonstrated previously in this section. Before applying any terminal action, we might need to run many operations on each stream element.</span></p>
<table style="border-collapse: collapse; width: 100.012%; height: 38.0374px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 38.0374px;">
<td style="width: 98.4238%; height: 38.0374px; text-align: center;">Also read: <em><strong><span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/java-inheritance-in-java" target="_blank">Inheritance in Java</a></span></strong></em></td>
</tr>
</tbody>
</table>
<p><strong>Peek ()</strong></p>
<p><span style="font-weight: 400;">In such circumstances, the peek() function could come in handy. To put it more simply, it does the action provided on each stream element and then returns a new stream that may use in subsequent processing. Peek () is an operation that occurs in between:</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>@Test

public void whenIncrementSalaryUsingPeek_thenApplyNewSalary()
 {

    Employee[] arrayOfEmps = {

        new Employee(1, "Jeff Bezos", 100000.0), 

        new Employee(2, "Bill Gates", 200000.0), 

        new Employee(3, "Mark Zuckerberg," 300000.0)

    };

    List&lt;Employee&gt; empList = Arrays.asList(arrayOfEmps);  

    empList.stream()

      .peek(e -&gt; e.salaryIncrement(10.0))

      .peek(System.out::println)

      .collect(Collectors.toList());

    assertThat(empList, contains(

      hasProperty("salary", equalTo(110000.0)),

      hasProperty("salary", equalTo(220000.0)),

      hasProperty("salary", equalTo(330000.0))

    ));

}</code></pre>
<h2><span style="color: #e67e23;"><strong><a id="method-types-and-pipelines"></a>Method types and pipelines</strong></span></h2>
<p><span style="font-weight: 400;">filter() and other similar intermediate procedures create a new stream that may use for further processing. When a stream is consumed by a terminal operation like forEach(), it can no longer use it.</span></p>
<p><span style="font-weight: 400;">In a stream pipeline, the first component is the stream source, then there may be one or more actions in between, and finally, there will be an end operation.</span></p>
<p><span style="font-weight: 400;">Here's a sample stream pipeline where emptiest is the source, filter() is the intermediate operation, and count over here is the terminal operation:</span></p>
<pre class="language-java"><code>@Test

public void whenStreamCount_thenGetElementCount() 
{

    Long empCount = empList.stream()

      .filter(e -&gt; e.getSalary() &gt; 200000)

      .count();

    assertEquals(empCount, new Long(1));

}</code></pre>
<p><span style="font-weight: 400;">Some of the processes can be categorized as "short-circuiting." Employing "short-circuiting" methods makes it possible to perform calculations on infinite streams in a finite amount of time.</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>@Test

public void whenLimitInfiniteStream_thenGetFiniteElements() {

    Stream&lt;Integer&gt; infiniteStream = .Stream.iterate(2, i -&gt; i * 2).;

    List&lt;Integer&gt; collect = infiniteStream

      .skip(3)

      .limit(5)

      .collect(Collectors.toList());

    assertEquals(collect, Arrays.asList(16, 32, 64, 128, 256));

}</code></pre>
<p>&nbsp;</p>
<p><span style="font-weight: 400;">In the above example, we used short-circuiting operations skip() to skip the first three elements and limit() to limit to 5 elements from the infinite stream generated using iterate().</span></p>
<h2><span style="color: #e67e23;"><strong><a id="lazy-evaluation"></a>Lazy evaluation</strong></span></h2>
<p><span style="font-weight: 400;">Lazy evaluation is one of the most critical parts of streams. As such, it is also one of the essential features of streams since it makes considerable improvements possible. As a result, lazy evaluation is one of the most important qualities of streams.</span></p>
<p><span style="font-weight: 400;">When the terminal action is started, the computation on the source data is carried out, and the source items are only consumed when it is essential to accomplish the task at hand. All activities that occur over the course of processing are referred to as being lazy, which means that they are placed on hold until it is essential to generate the result. It holds true for all the actions that occur during the processing.</span></p>
<p><strong>Example:</strong></p>
<pre class="language-java"><code>@Test

public void whenFindFirst_thenGetFirstEmployeeInStream() 
{

    Integer[] empIds = { 1, 2, 3, 4,5 };   

    Employee employee = Stream.of(empIds)

      .map(employeeRepository::findById)

      .filter(e -&gt; e != null)

      .filter(e -&gt; e.getSalary() &gt; 100000)

      .findFirst()

      .orElse(null);    

    assertEquals(employee.getSalary(), new Double(200000));

}</code></pre>
<table style="border-collapse: collapse; width: 100.012%; height: 23.0374px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 23.0374px;">
<td style="width: 98.4238%; text-align: center; height: 23.0374px;">Related Article: <em><strong><span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/java-annotations-in-java" target="_blank">Java Annotations</a></span></strong></em></td>
</tr>
</tbody>
</table>
<h3><span style="color: #e67e23;"><strong>Conclusion:</strong></span></h3>
<p><span style="font-weight: 400;">We got the basics of the java stream, and the details mentioned earlier will help you in developing knowledge for the java stream. We already discussed that Java is the essential programming language, and it is used in software and has a bright future. Learning the language in depth will surely help excellent or high-knowledge programmers.</span></p>
<p><span style="font-weight: 400;">It may seem complex or challenging to first-time users, but it will be easy with time and proper practice, as we know practice makes things easier. Making notes might help better learning instead of just reading it from the web page and trying to understand it. The examples mentioned are for better understanding any problem in understanding the theory portion; the examples might help in understanding the function of the element.&nbsp;</span></p>f:Ta5a,<p>&nbsp;</p>
<h2><span style="font-size: 18pt; color: #e67e23;"><strong>Stack using Linked List</strong></span></h2>
<p>Another way to represent a stack is by using a linked list. A <a title="Stack In Data Structures" href="stacks-in-datastructures" target="_blank" rel="noopener">stack</a> can be represented by using nodes of the <a title="Linked List In Data Structures" href="linked-list-in-data-structures" target="_blank" rel="noopener">linked list</a>. Each node contains two fields: data(info) and next(link) The data field of each node contains an item in the stack and the corresponding next field points to the node containing the next item in the stack The top refers to the topmost node (The last item inserted) in the stack. The empty stack is represented by setting top to nut. Because of the way the nodes are pointing, push and pop operations are easy to accomplish. &nbsp;</p>
<p><img class="alignnone wp-image-6620" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/442-460x432.png" alt=" Stack using Linked List" width="465" height="436" /> &nbsp; &nbsp; &nbsp;</p>
<h3><span style="font-size: 14pt;"><strong>Program:</strong></span></h3>
<h2><span style="font-size: 14pt; color: #e67e23;">Program to implement stack using linked list</span></h2>
<pre class="language-javascript"><code># include &lt;stdio.h&gt;
# include &lt;conio.h&gt;
# include &lt;stdlib.h&gt;
struct Node
{
int data;
struct node *top=NULL;
void insertion(int x)
{
struct node *temp;
temp=(struct node *) malloc (size of  (structure node));
temp 7 data =x;
temp7 link =top;
top=temp;
}
int deletion ()
{
struct node  *temp;
int x;
if(cop==NULL)
return -1;
else
{
temp=top;
top=top 7 link;
x=temp 7 data;
free(temp);
return x;
}
void display()
{
struct node *temp;
if(top=NULL)
printf(&ldquo;stack is empty n&rdquo;);
else
{
printf(&ldquo;The contents are &ldquo; n&rdquo;);
temp=top;
while(temp!=NULL)
{
printf(&ldquo;%5d&rdquo;,temp7data);
temp=temp7 link;
}
}
}
void main()
{
int ch, x;
clrscr();
printf(&ldquo;1.INSERTION n&rdquo;);
printf(&ldquo;2. DELETION n&rdquo;);
printf(&ldquo;3. DISPLAY  The stack n&rdquo;);
printf(&ldquo; 4. EXIT n&rdquo;);
do
{
printf(&ldquo;Enter ur choice : n&rdquo;);
scanf(&ldquo;%d&rdquo;, &amp;ch);
switch(ch)
{
case 1 :
printf(&ldquo;Enter Data elements : n&rdquo;)       ;
scanf(&ldquo;%d&rdquo;,&amp;x);
insertion(x);
case 2 :
x=deletion();
if(x==-1)
printf(&ldquo;STACK is EMPTY n&rdquo;)                 ;
else
printf(&ldquo; The Deleted value is : %d n&rdquo;,x);
break;
case 3:
display ();
break;
case 4:
Exit(0);
}
} while(ch&lt;=4);
getch();
}</code></pre>
<p>&nbsp; &nbsp;</p>10:T1860,<h2><span style="font-size: 18pt; color: #e67e23;"><strong>Linear Queue</strong></span></h2>
<p>A queue is an ordered list in which items may be added only at one end called the &ldquo;rear&rdquo; and items may be removed only at the other end called &ldquo;front&rdquo;.</p>
<h3><span style="font-size: 14pt;"><strong>Examples</strong></span></h3>
<ol>
<li>A line of passengers waiting to buy tickets at a reservation counter. Each new passenger gets in line at the &ldquo;rear&rdquo;; the passenger at the front of the lines is reserved.</li>
<li>A linear queue can be found in a time-sharing computer system where many users share the system simultaneously.</li>
<li>The first element, which is added to the queue will be the first one to be removed. Thus queues are also called First-in First-Out lists (FIFO) or Last-In-Last-Out lists (LILO).</li>
</ol>
<p>&nbsp; <img class="alignnone wp-image-6486" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/513-460x159.png" alt="Linear Queues" width="509" height="175" /> &nbsp;</p>
<ul>
<li>Queues may be represented in the computer memory by means of linear arrays or linked list.</li>
<li>There are two pointer variables namely FRONT and REAR.</li>
<li>The FRONT denotes the location of the first element of the queue.</li>
<li>The rear describes the location of the rear element of the queue.</li>
<li>When the queue is empty, the values of front and rear are-1 and -1 respectively.</li>
</ul>
<p>&nbsp;</p>
<ul>
<li>The &ldquo;max-size &ldquo;represents the maximum capacity of the linear queue.</li>
<li>The following is the condition to test the queue is full or not. (Rear== max size-1)</li>
<li>To insert the first element both pointers should be altered to &lsquo;0&rsquo; Front =0 rear=0.</li>
<li>Whenever an item is added to the queue, the value of REAR is incremented by 1. REAR =REAR+1;</li>
<li>The following is the condition to test the queue is empty or not. Front==-1</li>
<li>Whenever an &ldquo;Item&rdquo; is deleted from the queue, the value if the front is incremented by 1 Front=Front+1;</li>
<li>To delete the last element, both pointers should be altered.</li>
</ul>
<p style="text-align: center;"><a style="background-color: #e94350; color: #ffffff; padding: 10px 20px;" title="Data Structures Interview Questions And Answers" href="https://tekslate.com/interview-questions-on-data-structures" target="_blank">Data Structures Interview Questions</a></p>
<p>Front=-1; Rear=-1; &nbsp;</p>
<p><strong>Program:</strong> Implementation of linear queues using <a title="Arrays Concept in C++" href="wap-swapping-two-numbers-c-language" target="_blank" rel="noopener">arrays. </a></p>
<pre class="language-markup"><code># include &lt;studio.h&gt;
#include &lt;conio.h&gt;
#include &lt;stdlib.h&gt;
#define maxsize 5
intqueue [maxsize];
int Front=-1;
int Rear=-1;
void Insertion ()
{
intele;
if(Rear== maxsize-1)
{
printf(&ldquo;Queue is overflow n&rdquo;);
}
else
{
printf(&ldquo;Enter an element:&rdquo;);
sacnf(&ldquo;%d&rdquo;,&amp;ele);
Rear=Rear+1;
Queue[Rear]=ele;
if(Front==-1)
{
Front=0;
}
}
}
void deletion ()
{
if(Front==-1)
{
printf(&ldquo;Queue is under flown&rdquo;);
}
else
{
printf(&ldquo; Deleted element is: %d n&rdquo;, Queue [Front]);
if (Front==Rear)
{
Front=-1;
Rear=-1;
}
else
{
Front=Front+1;
}
}
}
void display ()
{
inti;
if (Front ==-1)
{
printf(&ldquo;Queue is under flow n&rdquo;);
}
else
{
for(i= Front; i&lt;= Rear; i++)
{
prinft(&ldquo;%5d&rdquo;,Queue[i]);
}
printf(&ldquo;n&rdquo;);
}
}
void main()
{
int choice;
clrscr();
int choice;
printf(&ldquo;1.INSERTION n&rdquo;);
printf(&ldquo;2.DELETION  n&rdquo;);
printf(&ldquo;3.DISPLAY  n&rdquo;);
printf(&ldquo;4.EXIT n&rdquo;);
do
{
printf(&ldquo;Enter your choice:&rdquo;);
scanf(&ldquo;%d&rdquo;,&amp;choice);
switch (choice)
{
case1: insertion (); break;
case2: deletion (); break;
case3: Display(); break;
case4: (0);
}
}
while (choice &lt;=4)
}</code></pre>
<p><strong>1). Initial State:</strong></p>
<p><img class="alignnone wp-image-6487" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/612-460x136.png" alt="Linear Queues" width="440" height="129" /> &nbsp;</p>
<p><strong>&nbsp;2). After inserting element 10</strong></p>
<p><img class="alignnone size-full wp-image-6488" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/713.png" alt="Linear Queues in Data Structures" width="300" height="110" /></p>
<p><strong> &nbsp; 3). After inserting elements </strong><strong>20, 30, 40, 50: </strong></p>
<p><img class="alignnone wp-image-6489" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/814-460x208.png" alt="Linear Queues in Data Structures" width="416" height="187" /></p>
<p><strong> 4). Inserting element 60 Queue is over flow &nbsp; </strong></p>
<p><strong>5).After deleting elements 10,20,30,40: </strong></p>
<p><img class="alignnone wp-image-6490" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/94-460x266.png" alt="Linear Queues in Data Structures" width="375" height="216" /></p>
<p><strong>&nbsp; &nbsp;5). After inserting elements 20, 30, 40, 50: </strong></p>
<p><img class="alignnone size-full wp-image-6491" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/104.png" alt="Linear Queues in Data Structures" width="411" height="99" /> &nbsp;</p>
<h2><span style="font-size: 14pt; color: #e67e23;"><strong>Applications of the queue:</strong></span></h2>
<ul>
<li>A queue can be used to store a lift of interrupts t=in the operating system, which would get processed in the order in which they were generated.</li>
<li>A queue can be found in a time-sharing computer system where many users share the system simultaneously.</li>
<li>In a computer network, messages from one to the computer generally create asynchronously. These messages, therefore, need to be buffered until the receiving computer is ready for id. These communication buffers make extensive use of queues by staring these messages in a queue. Also, the messages need to be sent to receiving computer in the same order in which they are created, i.e. FIFO order.</li>
</ul>
<p>&nbsp;</p>11:T120c5,<p>Are you planning to attend an interview for a Java role but confused on how to crack that interview and also what would be the most probable Advanced Java Interview Questions that the interviewer may ask? Well, you have reached the right place. Tekslate has collected the most frequently asked Java Advanced Interview Questions which are often asked in multiple interviews.</p>
<table style="border-collapse: collapse; width: 100%; height: 120px;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 37px; background-color: #ecf0f1; border-color: #ced4d9; border-style: solid;">
<td style="width: 98.3496%;">
<h3 style="text-align: center;"><span style="font-size: 18px;"><strong>Most frequently asked Advanced Java Interview Questions</strong></span></h3>
</td>
</tr>
<tr style="height: 37px; border-color: #ced4d9; border-style: solid;">
<td style="width: 98.3496%;">
<ul>
<li><a href="#q1"><span style="color: #236fa1;">What are java objects and java applications?&nbsp;</span></a></li>
<li><a href="#q3"><span style="color: #236fa1;">Advantages and disadvantages of Java Sockets.</span></a></li>
<li><a href="#q5"><span style="color: #236fa1;">Explain the different ways of using thread?</span></a></li>
<li><a href="#q8"><span style="color: #236fa1;">What is the difference between ArrayList and vector?&nbsp;</span></a></li>
<li><a href="#q12"><span style="color: #236fa1;">What is an Iterator?</span></a></li>
<li><a href="#q15"><span style="color: #236fa1;">What is synchronization and why is it important?</span></a></li>
<li><a href="#q19"><span style="color: #236fa1;">What is static in java?</span></a></li>
<li><a href="#q24"><span style="color: #236fa1;">What if I do not provide the String array as the argument to the method?</span></a></li>
<li><a href="#q28"><span style="color: #236fa1;">Can an application have multiple classes having the main method?</span></a></li>
<li><a href="#q30"><span style="color: #236fa1;">Do I need to import java.lang package any time? Why?</span></a></li>
<li><a href="#q47"><span style="color: #236fa1;">What makes Java platform independent?</span></a></li>
<li><a href="#q50"><span style="color: #236fa1;">Explain the difference between the abstract and final keywords?</span></a></li>
</ul>
</td>
</tr>
</tbody>
</table>
<h2><span style="font-size: 24px; color: #236fa1;"><strong>Advanced Java Interview Questions</strong></span></h2>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q1"></a>Q1) What are java objects and java applications?</strong>&nbsp;</span></h3>
<p><strong>Ans.</strong> Java object is an object that is provided by the execution of an application. When an application is compiled an object of that application is being made. Java application on the other hand is a program that is being written in Java and being read by the <span style="color: #236fa1;"><a class="zem_slink" style="color: #236fa1;" title="Java virtual machine" href="http://en.wikipedia.org/wiki/Java_virtual_machine" target="_blank" rel="nofollow">Java virtual machine</a></span>.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><span style="line-height: 1.5;">Q2) What is the purpose of garbage collection in Java, and when is it used?</span></strong></span></h3>
<p><strong>Ans.</strong> The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q3"></a>Q3) Advantages and disadvantages of Java Sockets.</strong></span></h3>
<p><strong>Ans:</strong></p>
<p><em><strong>Advantages of Java Sockets:</strong></em>&nbsp;</p>
<p>Sockets are flexible and easy to implement for general communications. - Sockets cause low network traffic unlike <span style="color: #236fa1;"><a class="zem_slink" style="color: #236fa1;" title="Form (HTML)" href="http://en.wikipedia.org/wiki/Form_%28HTML%29" target="_blank" rel="nofollow">HTML forms</a></span> and CGI scripts that generate and transfer whole web pages for each new request.</p>
<p><em><strong>Disadvantages of Java Sockets:</strong></em></p>
<p>Socket-based communications allow only to send packets of raw data between applications. - Both the client side and server side have to provide mechanisms to make the data useful in any way.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q4) Describe synchronization with respect to multithreading.</strong></span></h3>
<p><strong>Ans. </strong>With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating the same shared variable. This usually leads to significant errors.</p>
<table style="border-collapse: collapse; width: 100%; height: 60px; background-color: #ecf0f1; border-color: #CED4D9; border-style: solid;" border="1px" cellpadding="5">
<tbody>
<tr style="height: 41px;">
<td style="width: 98.2759%; height: 41px; text-align: center;"><em>Do you want to master Advanced Java? Then enrol in<span style="color: #236fa1;"><a style="color: #236fa1;" title="Advanced Java Training" href="https://tekslate.com/advanced-java-training" target="_blank"><strong> "Advanced Java Training"</strong></a></span> This course will help you to master Advanced Java.</em></td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q5"></a>Q5) Explain the different ways of using thread?</strong></span></h3>
<p><strong>Ans. </strong>The thread could be implemented by using a runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritances. the only interface that can help.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q6) What is an immutable class? How to create an immutable class?</strong>&nbsp;</span></h3>
<p><strong>Ans.</strong> An immutable<a class="zem_slink" title="Immutable object" href="http://en.wikipedia.org/wiki/Immutable_object" target="_blank" rel="nofollow">&nbsp;<span style="color: #000000;">class</span></a> is a class that once created, contents can not be changed. - Immutable objects are objects whose state can not be changed once constructed. - Since the state of the immutable objects can not be changed once they are created they are automatically synchronized/thread-safe. - Immutable objects are automatically thread-safe since the state of the immutable objects can not be changed once they are created - All wrapper classes in Java. lang are immutable, i.e. String, Integer, Boolean, Character, Byte, Short, Long, Float, Double, BigDecimal, BigInteger</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q7) What is pass by reference and pass by value?</strong></span></h3>
<p><strong>Ans.</strong> <span style="color: #000000;"><a class="zem_slink" style="color: #000000;" title="Evaluation strategy" href="http://en.wikipedia.org/wiki/Evaluation_strategy" target="_blank" rel="nofollow">Pass By Reference</a></span> means passing the address itself rather than passing the value. Pass by Value means passing a copy of the value to be passed.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q8"></a>Q8) What is the difference between ArrayList and vector?</strong>&nbsp;</span></h3>
<p><strong>Ans.</strong> ArrayList is not thread-safe whereas Vector is thread-safe. - In the Vector class each method is surrounded by a synchronized block and thus making Vector class thread-safe. - Both the ArrayList and Vector hold onto their contents using an Array. - When an element is inserted into an ArrayList or a Vector, the object will need to expand its internal array if it runs out of room. - A Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q9) What is HashMap and Map?</strong></span></h3>
<p><strong>Ans. The map</strong>&nbsp;is Interface and Hashmap is the class that implements that.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q10) Difference between HashMap and HashTable?</strong></span></h3>
<p><strong>Ans. </strong>The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesn't allow). HashMap does not guarantee that the order of the map will remain constant over time. HashMap is unsynchronized and Hashtable is synchronized.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q11) What is the difference between a constructor and a method?</strong></span></h3>
<p><strong>Ans. </strong>A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q12"></a>Q12) What is an Iterator?</strong></span></h3>
<p><strong>Ans. </strong>Some of the collection classes provide traversal of their contents via java. util.Iterator interface. This interface allows you to walk through a collection of objects, operating on each object in turn. Remember when using <span style="color: #000000;"><a class="zem_slink" style="color: #000000;" title="Iterator" href="http://en.wikipedia.org/wiki/Iterator" target="_blank" rel="noopener wikipedia">Iterators</a></span> that they contain a snapshot of the collection at the time the Iterator was obtained; generally, it is not advisable to modify the collection itself while traversing an Iterator. &nbsp;</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q13) What is the difference between multitasking and multithreading?</strong></span></h3>
<p><strong>Ans. </strong></p>
<p><em><strong>Multitasking includes two ways of representation:</strong> </em></p>
<p>1. Preemptive multitasking: where the system terminates the idle process without asking the user.</p>
<p>For example Unix/Linux, Windows NT</p>
<p>2. <span style="color: #000000;"><a class="zem_slink" style="color: #000000;" title="Computer multitasking" href="http://en.wikipedia.org/wiki/Computer_multitasking" target="_blank" rel="nofollow">Non-preemptive multitasking</a></span>: where the system asks the process to give control to other processes for execution.</p>
<p>For example Windows 3.1 and Mac OS 9.</p>
<p><em><strong>Multithreading:</strong></em></p>
<p>1. Multithreaded programs are program that extends the functionality of multitasking by dividing the program in the thread and then executing the task as individual threads.</p>
<p>2. Threads run in a different area and each thread utilizes some amount of CPU and memory for execution.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q14) What is the difference between an Interface and an Abstract class?</strong></span></h3>
<p><strong>Ans. </strong>An abstract class can have instance methods that implement a default behaviour. An Interface can only declare constants and instance methods, but cannot implement default behaviour and all methods are implicitly abstract. An interface has all public members and no implementation. An abstract class is a class that may have the usual flavours of class members (private, protected, etc.), but has some abstract methods.</p>
<p>&nbsp;</p>
<h2 id="java1" style="color: #236fa1; font-size: 16pt;"><span style="font-size: 24px;">Java Advanced Interview Questions</span></h2>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q15"></a>Q15) What is synchronization and why is it important?</strong></span></h3>
<p><strong>Ans. </strong>With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q16) Difference between Vector and ArrayList?</strong></span></h3>
<p><strong>Ans. </strong>Vector is synchronized whereas ArrayList is not.</p>
<table style="border-collapse: collapse; width: 100%; height: 26px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 26px;">
<td style="width: 98.2759%; height: 26px; text-align: center;"><em>Go through this <span style="color: #236fa1;"><strong><a style="color: #236fa1;" title="Advanced Java Tutorial" href="https://tekslate.com/advanced-java-tutorials" target="_blank">Advanced Java Tutorial</a></strong></span> to learn Advanced Java end-to-end!</em></td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q17) What is the difference between multiple processes and multiple threads?</strong></span></h3>
<p><strong>Ans. </strong>Multiple processes are the way to provide a multitasking environment to the user to allow him to switch over to different programs quickly. In these processes, it consists of a complete set of its own variables and data. Multiple threads share the same variable and the same data. Multiple processes are safe to use but multiple threads are riskier in the sense that they share the same data.</p>
<p>Multiple processes have much more overhead but multiple threads have less overhead and individual threads can be stand-alone if other threads are destroyed.</p>
<p>In multiple processes, intercommunication is slower and more restrictive, whereas communication between threads is faster.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q18) What is an abstract class?</strong></span></h3>
<p><strong>Ans. </strong>Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not be instantiated (ie, you may not call its constructor), an abstract class may contain static data. Any class with an <span style="color: #236fa1;"><a class="zem_slink" style="color: #236fa1;" title="Method (computer programming)" href="http://en.wikipedia.org/wiki/Method_%28computer_programming%29" target="_blank" rel="nofollow">abstract method</a></span> is automatically abstract itself and must be declared as such. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q19"></a>Q19) What is static in Java?</strong></span></h3>
<p><strong>Ans. </strong>Static means one per class, not one for each object no matter how many instances of a class might exist. This means that you can use them without creating an instance of a class. Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q20) What is the final?</strong></span></h3>
<p><strong>Ans.&nbsp; </strong>A final class can't be extended ie., the final class may not be subclassed. A final method can't be overridden when its class is inherited. You can't change the value of a final variable (is a constant).</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q21) What if the main method is declared as private?</strong></span></h3>
<p><strong>Ans. </strong>The program compiles properly but at runtime, it will give a "Main method not public." message.</p>
<p><span style="color: #e67e23; font-size: 18px;"><strong>Q22) What if the static modifier is removed from the signature of the main method?</strong></span></p>
<p><strong>Ans:</strong> Program compiles. But at runtime throws an error "NoSuchMethodError".</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q23) What if I write a static public void instead of a public static void?</strong></span></h3>
<p><strong>Ans. </strong>The program&nbsp;compiles and runs properly.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q24"></a>Q24) What if I do not provide the String array as the argument to the method?</strong></span></h3>
<p><strong>Ans. </strong>The program&nbsp;compiles but throws a runtime error "NoSuchMethodError".</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q25) What is the first argument of the String array in the main method?</strong></span></h3>
<p><strong>Ans. </strong>The String array is empty. It does not have any element. This is unlike C/C++ where the first element by default is the program name.</p>
<h3><span style="font-size: 18px; color: #e67e23;">Q26) If I do not provide any arguments on the command line, then the String array of the Main method will be empty or null?</span></h3>
<p><strong>Ans. </strong>It is empty. But not null.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q27"></a>Q27) How can one prove that the array is not null but empty using one line of code?</strong></span></h3>
<p><strong>Ans. </strong>Print args. length. It will print 0. That means it is empty. But if it would have been null then it would have thrown a NullPointerException on attempting to print args. length.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q28"></a>Q28) Can an application have multiple classes having the main method?</strong></span></h3>
<p><strong>Ans. </strong>Yes, it is possible. While starting the application we mention the class name to be run. The JVM will look for the Main method only in the class whose name you have mentioned. Hence there is no conflict amongst the multiple classes having the main method.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q29) Can I have multiple main methods in the same class?</strong></span></h3>
<p><strong>Ans. </strong>No, the program fails to compile. The compiler says that the main method is already defined in the class.</p>
<p>&nbsp;</p>
<h2 id="java2"><span style="color: #236fa1; font-size: 24px;">Core Java Interview Questions</span></h2>
<h3><span style="font-size: 18px; color: #e67e23;"><strong><a id="q30"></a>Q30) Do I need to import Java.lang package any time? Why?</strong></span></h3>
<p><strong>Ans. </strong>No. It is by default loaded internally by the JVM.</p>
<h4><span style="font-size: 18px;"><strong><span style="color: #e67e23;">Q31) Can I import the same package/class twice? Will the JVM load the package twice at runtime?</span></strong></span></h4>
<p><strong>Ans. </strong>One can import the same package or same class multiple times. Neither compiler nor JVM complains abt it. And the JVM will internally load the class only once no matter how many times you import the same class.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q32) What is Checked and Unchecked Exception?</strong></span></h3>
<p><strong>Ans. </strong>A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked forces client programmers to deal with the possibility that the exception will be thrown. eg, IOException thrown by java.io.FileInputStream's read() method Unchecked exceptions is RuntimeException and any of its subclasses. Class Error and its subclasses also are unchecked. With an unchecked exception, however, the compiler doesn't force client programmers either to catch the exception or declare it in a throws clause. In fact, client programmers may not even know that the exception could be thrown. eg, StringIndexOutOfBoundsException thrown by String's charAt() methodChecked exceptions must be caught at compile time. Runtime exceptions do not need to be. Errors often cannot be.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q33) What is Overriding?</strong></span></h3>
<p><strong>Ans. </strong>When a class defines a method using the same name, return type, and arguments as a method in its superclass, the method in the class overrides the method in the superclass. When the method is invoked for an object of the class, it is the new definition of the method that is called and not the method definition from the superclass. Methods may be overridden to be more public, not more private.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q34) What are the different types of inner classes?</strong></span></h3>
<p><strong>Ans. </strong>Nested top-level classes, Member classes, Local classes, Anonymous classes Nested top-level classes- If you declare a class within a class and specify the static modifier, the compiler treats the class just like any other top-level class. Any class outside the declaring class accesses the nested class with the declaring class name acting similarly to a package. eg, outer. inner.</p>
<p>Top-level inner classes implicitly have access only to static variables. There can also be inner interfaces. All of these are of the nested top-level variety.</p>
<p>Member classes - Member inner classes are just like other member methods and member variables and access to the member class is restricted, just like methods and variables. This means a public member class acts similarly to a nested top-level class. The primary difference between member classes and nested top-level classes is that member classes have access to the specific instance of the enclosing class.</p>
<p>Local classes - Local classes are like local variables, specific to a block of code. Their visibility is only within the block of their declaration. In order for the class to be useful beyond the declaration block, it would need to implement a more publicly available interface. Because local classes are not members, the modifiers public, protected, private, and static are not usable.</p>
<p>Anonymous classes - Anonymous inner classes extend local inner classes one level further. As anonymous classes have no name, you cannot provide a constructor.</p>
<table style="border-collapse: collapse; width: 100%; height: 41px; background-color: #ecf0f1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 41px;">
<td style="width: 98.2759%; height: 41px; text-align: center;"><em>Do you want to master Core Java? Then enroll in<strong><a href="https://tekslate.com/core-java-training" target="_blank"> <span style="color: #236fa1;">"Core Java Training"</span></a></strong><span style="color: #236fa1;"> </span>This course will help you to master Advanced Java.</em></td>
</tr>
</tbody>
</table>
<h5><span style="font-size: 18px;"><strong><span style="color: #e67e23;">Q35) Are the imports checked for validity at compile time? e.g. will the code contain an import such as java.lang.ABCD compile?</span></strong></span></h5>
<p><strong>Ans. </strong>Yes, the imports are checked for semantic validity at compile time. The code containing the above line of import will not compile. It will throw an error saying, can not resolve symbol: class ABCD location: package io import java.io.ABCD;</p>
<h4><span style="color: #e67e23; font-size: 18px;"><strong>Q36) Does importing a package imports the subpackages as well? e.g. Does import com.MyTest.* also import com.MyTest.UnitTests.*?</strong></span></h4>
<p><strong>Ans. </strong>No, you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of its subpackage.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q37) What is the difference between declaring a variable and defining a variable?</strong></span></h3>
<p><strong>Ans. </strong>In a declaration, we just mention the type of the variable and its name. We do not initialize it. But defining means declaration + initialization. e.g String s; is just a declaration while String s = new String ("abcd"); Or String s = "abcd"; are both definitions.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q38) What is the default value of an object reference declared as an instance variable?</strong></span></h3>
<p><strong>Ans. </strong>null unless we define it explicitly.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q39) Can a top-level class be private or protected? </strong></span></h3>
<p><strong>Ans. </strong>No. A top-level class can not be private or protected. It can have either a "public" or no modifier. If it does not have a modifier it is supposed to have default access. If a top-level class is declared as private the compiler will complain that the "modifier private is not allowed here". This means that a top-level class can not be private. The same is the case with protected.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q40) What type of parameter passing does Java support?</strong></span></h3>
<p><strong>Ans. </strong>In <span style="color: #000000;">Java,</span> the arguments are always passed by value.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q41) Primitive data types are passed by reference or pass by value?</strong></span></h3>
<p><strong>Ans. </strong>Primitive data types are passed by value.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q42) Objects are passed by value or by reference?</strong>&nbsp;</span></h3>
<p><strong>Ans. </strong>Java only supports pass-by values. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q43) What is serialization?</strong></span></h3>
<p><strong>Ans. </strong>Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q44) How do I serialize an object to a file?</strong></span></h3>
<p><strong>Ans. </strong>The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file.</p>
<p>&nbsp;</p>
<h2 id="java3"><span style="color: #236fa1; font-size: 24px;">Java Technical Interview Questions</span></h2>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong><a id="q45"></a>Q45) </strong></span><span style="color: #e67e23;">What is the difference between compile-time polymorphism and runtime polymorphism?</span></span></h3>
<p><span style="color: #000000;"><strong>Ans. </strong>The following table lists the differences between compile-time and runtime polymorphism:</span></p>
<table style="border-collapse: collapse; width: 100%; height: 193px; border-style: solid;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 44px;">
<td style="width: 51.4941%; height: 44px;" width="317">
<p style="text-align: center;"><em><strong>Compile-time polymorphism</strong></em></p>
</td>
<td style="width: 48.5059%; height: 44px;" width="297">
<p style="text-align: center;"><em><strong>Runtime polymorphism</strong></em></p>
</td>
</tr>
<tr style="height: 44px;">
<td style="width: 51.4941%; height: 44px;" width="317">
<p>Also known as static polymorphism</p>
</td>
<td style="width: 48.5059%; height: 44px;" width="297">
<p>Also known as dynamic polymorphism</p>
</td>
</tr>
<tr style="height: 60px;">
<td style="width: 51.4941%; height: 60px;" width="317">
<p>Achieved through method overloading (Allowing a class to have multiple methods with the same name but different number/type of arguments)</p>
</td>
<td style="width: 48.5059%; height: 60px;" width="297">
<p>Achieved through method overriding (Allowing a subclass to have a method with the same name and type signature as a superclass)</p>
</td>
</tr>
<tr style="height: 45px;">
<td style="width: 51.4941%; height: 45px;" width="317">
<p>The call to the overloaded method is resolved at compile-time</p>
</td>
<td style="width: 48.5059%; height: 45px;" width="297">
<p>The call to the overridden method is resolved at runtime</p>
<p>&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q46) </strong></span><span style="color: #e67e23;"><strong>What is encapsulation? Explain with a code sample</strong></span></span></h3>
<p><span style="color: #000000;"><strong>Ans. </strong></span>Encapsulation simply means keeping the data of a class hidden from the outside world. This is achieved by creating a class that has private fields and public getter/setter methods.</p>
<p>The following class is an example of encapsulation:</p>
<p><code><strong>public class House {</strong></code><br /><code><strong>&nbsp; &nbsp;&nbsp;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; private int numRooms;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; private String location;</strong></code><br /><code><strong>&nbsp; &nbsp;&nbsp;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; public int getNumRooms() {</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return numRooms;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; }</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; public void setNumRooms(int numRooms) {</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.numRooms = numRooms;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; }</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; public String getLocation() {</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return location;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; }</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; public void setLocation(String location) {</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.location = location;</strong></code><br /><code><strong>&nbsp; &nbsp; &nbsp; &nbsp; }</strong></code><br /><code><strong>}</strong></code></p>
<p>This code defines a class called House. It has two fields called numRooms and location, both are private and so cannot be accessed directly outside the class. Both fields have getter and setter methods which can be used by code outside the class.</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong><a id="q47"></a>Q47) </strong></span><span style="color: #e67e23;"><strong>What makes Java platform independent?</strong></span></span></h3>
<p><span style="color: #000000;"><strong>Ans. </strong></span>Other programming languages like C, C++ are compiled into platform specific binary files with .exe extension. So, the binary file for one operating system does not work on other operating systems. Unlike these languages, Java gets compiled into bytecode. Bytecode is executed within a Java Virtual Machine (JVM) and the same bytecode works on all operating systems. So, Java is platform independent.&nbsp;</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q48) </strong></span><span style="color: #e67e23;"><strong>What is a literal? Give some examples of literals</strong></span></span></h3>
<p><span style="color: #000000;"><strong>Ans. </strong></span>A literal is nothing but a constant value that can be assigned to a variable. Literals can be classified according to their data type. The following are some examples of literals:<br />&bull; &nbsp; &nbsp;10,20 &ndash; These are all Integer literals since they correspond to Integer values<br />&bull; &nbsp; &nbsp;26.45,31.89 &ndash; These are all floating-point literals since they represent floating-point (decimal) values.<br />&bull; &nbsp; &nbsp;&lsquo;A&rsquo;, &lsquo;b&rsquo;, &lsquo;%&rsquo; &ndash; These are character literals since they hold an individual character. Character literals need to be enclosed in single quotes<br />&bull; &nbsp; &nbsp;&ldquo;Java&rdquo;, &ldquo;Test&rdquo; &ndash; These are String literals since they hold String values. String literals need to be enclosed in double quotes</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q49)</strong></span><span style="color: #e67e23;">&nbsp;<strong>Explain why the Java main method is static.</strong></span></span></h3>
<p><span style="color: #000000;"><strong>Ans. </strong></span>A static method can be invoked directly via the class name and does not need an object of the class to be created. The Java main method is invoked by the JVM as soon as a Java program is executed. Hence, the JVM should be able to invoke the main method even before creating an object of the class. Hence the main method is static.</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong><a id="q50"></a>Q50) </strong></span><span style="color: #e67e23;"><strong>Explain the difference between the abstract and final keywords?</strong></span></span></h3>
<p><span style="color: #000000;"><strong>Ans. </strong></span>The following table lists the differences between the abstract and final keywords:</p>
<table style="border-collapse: collapse; width: 100%; border-style: solid;" border="1px" cellpadding="10">
<tbody>
<tr>
<td style="width: 51.4941%;" width="317">
<p style="text-align: center;"><em><strong>Abstract</strong></em></p>
</td>
<td style="width: 48.5059%;" width="297">
<p style="text-align: center;"><em><strong>final</strong></em></p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Can be specified with a class or method. Cannot be specified with a field</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Can be specified with a field, method or class.</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>When specified with a method, indicates that the method is abstract. So, a subclass needs to provide an implementation for the abstract method or be declared as abstract itself</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>When specified with a method, indicates that the method cannot be overridden. So, if a subclass tries to provide an implementation for the final method a compilation error occurs</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>When specified with a class, indicates that the class is abstract. So, a subclass needs to provide an implementation for the abstract methods within the class or must be declared as abstract itself</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>When specified with a class, indicates that the class cannot be extended. So, if some code tries to create a subclass of a final class, a compilation error occurs.</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>An abstract class cannot be instantiated</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>A final class can be instantiated</p>
</td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q51) </strong></span><span style="color: #e67e23;"><strong>Is the following code valid? Explain your answer</strong></span></span></h3>
<p>short s = 10; // 1</p>
<p>s = s + 10; // 2</p>
<p><span style="font-size: 12pt; color: #e67e23;"><strong><span style="color: #000000;">Ans. </span></strong><span style="color: #000000;"><span style="font-size: 14px;">The code above is not valid and causes a compilation error at Line 2. This is because Line 2 adds the value 10 to the short variable s. By default, the literal 10 is treated to be of type int and so Line 2 produces a result of type int but tries to assign it to a variable of type short. This code can be fixed either by changing the data type of s to int or by explicitly casting the result of s+10 to int as follows:</span><br /><span style="font-size: 14px;">s = (short)(s + 10);</span><br /></span></span></p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q52) </strong></span><span style="color: #e67e23;"><strong>What is a two-dimensional array? Give some examples of two-dimensional arrays.</strong></span></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><strong><span style="color: #000000;">Ans. </span></strong></span>A two-dimensional array is nothing but an array having two dimensions. In other words, it is an array of arrays, that is each array within a two-dimensional array is an array itself. The following are some examples of two-dimensional arrays:</span></p>
<p>&nbsp; &nbsp; &nbsp;int array1[ ][ ] = new int[3][6];</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; double array2[ ][ ] = new double[2][5];</p>
<p>array1 is a two-dimensional integer array having dimensions 3,6. array2 is a two-dimensional double array having dimensions 2,5.</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong><a id="q54"></a>Q54) </strong></span><span style="color: #e67e23;"><strong>Explain the difference between the prefix and postfix increment operator with a code sample.</strong></span></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><strong><span style="color: #000000;">Ans. </span></strong></span></span>Both the prefix and postfix form of the increment operator increments its operand by 1. However, when used in a statement, the prefix operator first performs the increment operation and then the assignment while the postfix operator first performs the assignment and then the increment operation.</p>
<p><span style="font-size: 14px; color: #000000;">The following code sample demonstrates this:</span></p>
<p>int n1=10;<br />int n2=++n1;</p>
<p><span style="font-size: 14px; color: #000000;">The code above first causes n1 to be incremented and then assigned to n2, so n2 has the value 11.&nbsp;</span></p>
<p><span style="font-size: 14px; color: #000000;">Now consider the following code:<br /></span></p>
<p><span style="font-size: 14px; color: #000000;">int n1=10;<br />int n2=n1++;<br /></span></p>
<p><span style="font-size: 14px; color: #000000;">The code above first causes n2 to be assigned with the value of n1 and then n1 is incremented, so n2 has the value 10.</span></p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q55) </strong></span><span style="color: #e67e23;"><strong>What will be the output of the following code? Explain your answer</strong></span></span></h3>
<p><span style="font-size: 16px; color: #e67e23;"><span style="color: #000000; font-size: 14px;">int num1 = 17;</span><br /><span style="color: #000000; font-size: 14px;">int num2 = 25;</span><br /><span style="color: #000000; font-size: 14px;">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><br /><span style="color: #000000; font-size: 14px;">int num3 = num1 &amp; num2;</span><br /><span style="color: #000000; font-size: 14px;">System.out.println(num3);</span><strong><br /></strong></span></p>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><strong><span style="color: #000000;">Ans.&nbsp; </span></strong></span><span style="color: #e67e23;"><span style="color: #000000;">The code above prints the following output:</span></span></span></p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 17</p>
<p>The code above uses the bitwise AND (&amp;) operator on num1 and num2. The &amp; operator performs a bitwise AND operation on the binary representations of its operands. So, it returns 1 only if both the bits are 1. So, the above operation can be represented in binary form as below:</p>
<p>00010001 (17)<br />00011001 (25)<br />--------------<br />00010001 (17)</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q56) </strong></span><span style="color: #e67e23;"><strong>Explain the break and continue statements?</strong></span></span></h3>
<p><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;"><span style="font-size: 14px;">Both the break and continue statements are control statements that can be used to transfer control to a different part of a program. Both can be used within a loop. When a break statement is encountered within a loop, it causes the loop to be terminated and control is transferred to the first statement outside the loop. When a continue statement is encountered within a loop, it causes the current iteration of the loop to be skipped and control is transferred to the top of the loop. The loop then continues for the next iteration</span>.</span></span></span></span></p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q57)&nbsp; </strong></span><span style="color: #e67e23;"><strong>What will be the output of the following code? Explain your answer</strong></span></span></h3>
<p><span style="font-size: 14px;"><code><span style="color: #e67e23;"><strong><span style="color: #000000;"><span style="color: #e67e23;"><span style="color: #000000;">String taskStatus = "IN_PROGRESS";<br />&nbsp; &nbsp; switch (taskStatus) {<br />&nbsp; &nbsp; &nbsp; &nbsp; case "ASSIGNED":<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Task is assigned");<br />&nbsp; &nbsp; &nbsp; &nbsp; case "IN_PROGRESS":<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Task is in progress");<br />&nbsp; &nbsp; &nbsp; &nbsp; case "COMPLETED":<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println("Task is completed");<br />}</span></span></span></strong></span></code></span></p>
<p><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>The code above uses a switch statement which matches the value of the taskStatus variable with the value in each case statement. Since taskStatus matches the second case statement, it executes the code in this case statement and the code in the subsequent case statements. So, the code above prints the following output:</p>
<p>Task is in progress<br />Task is completed</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q58) What is the use of the new keyword?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>The new keyword is used along with a constructor to create a new Java object. It has the following syntax:</span></p>
<p><span style="font-size: 14px; color: #000000;">Class1 ob = new Class1();</span></p>
<p><span style="font-size: 14px; color: #000000;">The line above creates an object called ob of the type Class1. The new keyword is followed by the class name that is Class1. This allocates memory for the object ob, that is the instance fields of ob.</span></p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q59) Is the following code valid? Explain your answer</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;">Integer num = Integer.valueOf("100");</span></p>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>Yes, the code above is valid. It creates an Integer object corresponding to the value 100. Integer is a wrapper class corresponding to the int data type. Integer class has a static method called valueOf that can accept as parameter a String and return the Integer value corresponding to the String. In case an invalid Integer is specified within the valueOf method, it throws an Exception.</span></p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q60) Explain the different types of Inheritance supported by Java?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>Java supports the following types of inheritance:</span></p>
<ul>
<li><span style="font-size: 14px; color: #000000;"><em><strong>Single Inheritance</strong></em> &ndash; Occurs when a class has only one subclass</span></li>
<li><span style="font-size: 14px; color: #000000;"><em><strong>Multi-level Inheritance</strong></em> &ndash; Occurs when there is a chain of inheritance. That is, a subclass in turn has a subclass</span></li>
<li><span style="font-size: 14px; color: #000000;"><em><strong>Hierarchical Inheritance</strong></em> &ndash; Occurs when a class has multiple subclasses<br /></span></li>
</ul>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q61) Identify the error in the following code snippet and explain how it can be fixed?</strong></span></h3>
<div><code><strong>public class House {</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>}</strong></code></div>
<div><code><strong>public class RowHouse extends House {</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>public static void main(String[] args) {</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>House h1 = new RowHouse();//1</strong></code></div>
<div><code><strong>RowHouse h2 = new House(); //2</strong></code></div>
<div><code><strong>}</strong></code></div>
<div><code><strong>}</strong></code></div>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>This code creates a class called House which has a subclass called RowHouse. Line 1 declares a House variable h1 and assigns it a RowHouse object. This is valid since a subclass object can be assigned to a superclass variable. Line 2 declares a RowHouse object h2 and assigns it a House object. This is invalid and causes a compilation error, since a superclass object cannot be assigned to a variable of a subclass type. So, in order to fix this error, Line 2 needs to be removed from the code.</span></p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q62) Explain the differences between static and default interface methods?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span>The following table lists the differences between static and default interface methods:</p>
<table style="border-collapse: collapse; width: 100%; border-style: solid;" border="1px" cellpadding="5">
<tbody>
<tr>
<td style="width: 51.4941%;" width="317">
<p style="text-align: center;"><em><strong>Default</strong></em></p>
</td>
<td style="width: 48.5059%;" width="297">
<p style="text-align: center;"><em><strong>Static</strong></em></p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Has the keyword &lsquo;default&rsquo; specified in the method declaration</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Has the keyword &lsquo;static&rsquo; specified in the method declaration</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Can be overridden by an implementing class</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Cannot be overridden by an implementing class</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Can be invoked via an object of the implementing class</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Can only be invoked via the interface name</p>
</td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q63) Identify the error in the code below and explain how you can fix it?</strong></span></h3>
<div><code><strong>public interface First {</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>public void firstMethod();</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>}</strong></code></div>
<div><code><strong>public interface Second {</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>public void secondMethod();</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>}</strong></code></div>
<div><code><strong>public class House implements First,Second{</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>public void firstMethod() {</strong></code></div>
<div><code><strong>System.out.println("First Method");</strong></code></div>
<div><code><strong>}</strong></code></div>
<div><code><strong>}</strong></code></div>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span>The code above will cause a compilation error in the class House. Since the House class implements the interfaces First and Second, it needs to provide code for all the methods in both interfaces. However, in this case, the House class only has code for firstMethod from the interface First. In order to fix the code, it needs to include code for secondMethod from the interface Second. So, the House class needs to be fixed as follows:</p>
<div><code><strong>public class House implements First,Second{</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>public void firstMethod() {</strong></code></div>
<div><code><strong>System.out.println("First Method");</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>}</strong></code></div>
<div>&nbsp;</div>
<div><code><strong>public void secondMethod() {</strong></code></div>
<div><code><strong>//code here</strong></code></div>
<div><code><strong>}</strong></code></div>
<div><code><strong>}</strong></code></div>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q64) What are access specifiers in Java? List all of Java&rsquo;s access specifiers</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span>Java&rsquo;s access specifiers help to control where an instance field/method of a class is accessible. Java has the following access specifiers:</p>
<ul>
<li><em><strong>Private </strong></em>&ndash; Specified by the private keyword. A private member is accessible only in the class where it is declared</li>
<li><em><strong>Default </strong></em>&ndash; When a class member does not have an explicit access specifier, it is said to have default access. A default member is accessible only in other classes within the same package</li>
<li><em><strong>Protected</strong></em> &ndash; Specified by the protected keyword. A protected member is accessible in other classes within the same package and in sub-classes that are outside the package</li>
<li><em><strong>Public</strong></em> &ndash; Specified by the public keyword. A public member Is accessible from anywhere.</li>
</ul>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q65) Explain the difference between the add and offer methods on the Queue interface?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>Both the add and the offer methods can be used to add an element to a Queue. However, there are some differences between the two as listed in the table below:</span></p>
<table style="border-collapse: collapse; width: 100%; border-style: solid;" border="1px" cellpadding="5">
<tbody>
<tr>
<td style="width: 51.4941%;" width="317">
<p style="text-align: center;"><em><strong>add</strong></em></p>
</td>
<td style="width: 48.5059%;" width="297">
<p style="text-align: center;"><em><strong>offer</strong></em></p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Method on the java.util.Collection interface</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Method on the java.util.Queue interface</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Throws an exception if it is not possible to add the specified element into the Queue</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Returns false if it is not possible to add the specified element into the Queue</p>
</td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q66) Explain with a code sample how you can swap two elements in a List?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span>The java.util.Collections class has a method called swap. It can be used to swap two elements in a List. The following code demonstrates this:</p>
<p><code><strong>List&lt;String&gt; animals = Arrays.asList("Lion","Elephant","Tiger","Zebra");</strong></code><br /><code><strong>&nbsp; &nbsp; Collections.swap(animals, 1, 2); //swaps elements at position 1,2</strong></code></p>
<p>This code causes the elements at position 1,2 to be swapped, so &ldquo;Tiger&rdquo; is moved to position 1 and &ldquo;Elephant&rdquo; is moved to position 2</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q67) Explain the difference between a checked and unchecked exception?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span>The following table lists the differences between a checked an unchecked exception:</span></p>
<table style="border-collapse: collapse; width: 100%; height: 120px;" border="1px" cellpadding="10">
<tbody>
<tr>
<td style="width: 51.4941%;" width="317">
<p><strong>Checked Exception</strong></p>
</td>
<td style="width: 48.5059%;" width="297">
<p><strong>Unchecked Exception</strong></p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>Checked by the compiler. So, if you write code that can throw a checked exception, the compiler causes an error unless the exception is handled or declared in the throws clause</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>Is not checked by the compiler. So, if you write code that can throw an unchecked exception, the compiler does not cause an error</p>
</td>
</tr>
<tr>
<td style="width: 51.4941%;" width="317">
<p>All subclasses of java.lang.Exception except java.lang.RuntimeException are unchecked exceptions</p>
</td>
<td style="width: 48.5059%;" width="297">
<p>All subclasses of java.lang.RuntimeException are unchecked exceptions</p>
</td>
</tr>
</tbody>
</table>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q68) Explain the throw and throws keywords in Java?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span>The throw keyword can be specified within any block of code. It can be used to explicitly throw an exception (both in-built as well as custom exception). It is followed by an Exception object. The throws keyword is specified in a method declaration. It indicates that the method is capable of throwing an exception but does not handle it and that the code that invokes the method needs to handle the exception. It is followed by the exception class name.</p>
<h3><span style="font-size: 18px;"><span style="color: #e67e23;"><strong>Q69) Explain how you can check if a String contains another String?</strong></span><span style="color: #e67e23;"><span style="color: #000000;"><span style="color: #e67e23;"><strong><span style="color: #000000;"><span style="color: #e67e23;"><span style="color: #000000;">&nbsp;</span></span></span></strong></span></span></span></span></h3>
<p><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans.&nbsp; </span></span></span></strong></span></span></span>The String class has several methods that can be used to check if a String contains another String. These are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>boolean contains(String str) &ndash; Accepts as parameter a String and returns a boolean value which indicates whether the String contains the specified String or not</li>
<li>int indexOf(String str) - Accepts as parameter a String and returns the position of its first occurrence if present, otherwise returns -1.</li>
<li>int lastIndexOf(String str) - Accepts as parameter a String and returns the position of its last occurrence if present, otherwise returns -1.</li>
</ol>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q70) What is the difference between the capacity and length methods on the StringBuffer class?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span></span>The capacity method on the StringBuffer class returns the capacity of the StringBuffer that is the number of characters that the StringBuffer is capable of holding. The length method on the StringBuffer class returns the actual length of the StringBuffer, that is the actual number of characters in the StringBuffer.</span></p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q71) What will be the output of the following code? Explain</strong></span></h3>
<p><span style="font-size: 14px;"><code><span style="color: #000000;"><span style="color: #e67e23;"><span style="color: #000000;"><span style="color: #e67e23;"><strong><span style="color: #000000;"><span style="color: #e67e23;"><span style="color: #000000;">File file = new File("C:/test");<br />file.mkdir();</span></span></span></strong></span></span></span></span></code></span></p>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span></span></span>The code above creates a File object corresponding to the C:/test path and then invokes the mkdir() method on this File object. This method creates a directory corresponding to the specified path. So, once the code above executes, a directory called &ldquo;test&rdquo; will be created in c:/</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q72) Explain with a code sample how you can delete a file from the file system?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span></span></span>The file class has a method called delete. This can be used to delete a file from the file system. The following code demonstrates this:</p>
<p><span style="color: #000000;"><strong><code>File file1=new File("C:/test.txt");</code></strong></span><br /><span style="color: #000000;"><strong><code>file1.delete();</code></strong></span></p>
<p>This code first creates a file object corresponding to &ldquo;C:/test.txt&rdquo; and then invokes the delete method on this file object. This causes the &ldquo;C:/test.txt&rdquo; file to be deleted from the file system.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q73) Explain what modifications need to be made to the code below so that it prints &ldquo;MyThread&rdquo;</strong></span></h3>
<p><span style="font-size: 18px; color: #e67e23;"><strong><span style="font-size: 14px;"><code><span style="color: #000000;">public class MyThread extends Thread{</span></code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp;&nbsp;</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; public void run() {</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(Thread.currentThread().getName());</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; }</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp;&nbsp;</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; public static void main(String[] args) {</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MyThread t = new MyThread();</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.start();</code></span><br /><span style="color: #000000; font-size: 14px;"><code>&nbsp; &nbsp; &nbsp; &nbsp; }</code></span><br /><span style="color: #000000; font-size: 14px;"><code>}</code></span><br /></strong></span></p>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span></span></span>The code above creates a Thread class called MyThread. The run method invokes the Thread.currentThread().getName()which prints the name of the current thread. So in order for the code to print &ldquo;MyThread&rdquo;, the name of the thread should be set to &ldquo;MyThread&rdquo;. For this you can do either of the following:</p>
<ol style="list-style-type: lower-alpha;">
<li>Add currentThread().setName("MyThread")in the run method</li>
<li>Add setName("MyThread")in the main method before invoking t.start();</li>
</ol>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q74)&nbsp; What will be the output of the following code? Explain</strong></span></h3>
<p><span style="font-size: 14px;"><code><span style="color: #000000;"><span style="color: #e67e23;"><span style="color: #000000;"><span style="color: #e67e23;"><strong><span style="color: #000000;"><span style="color: #e67e23;"><span style="color: #000000;">Map&lt;Character,String&gt; animals = Map.of('A',"Lion",'B',"Elephant",'C',"Tiger");<br />String animal = animals.getOrDefault('D', "Giraffe");</span></span></span></strong></span></span></span></span></code></span></p>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span></span></span>The code above uses the getOrDefault method on the animals map. This returns the value corresponding to the specified key if the key is present in the Map or the specified default value. Since there is no value corresponding to the key &lsquo;D&rsquo;, it returns the value &ldquo;<em>Giraffe</em>&rdquo;. So, the following is the output of the code listed above:</p>
<p><em>Giraffe</em></p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q75) Explain what is garbage collection?</strong></span></h3>
<p><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="font-size: 14px; color: #000000;"><span style="color: #e67e23;"><strong><span style="font-size: 14px; color: #000000;"><span style="font-size: 12pt; color: #e67e23;"><span style="color: #000000;">Ans. </span></span></span></strong></span></span></span></span>Java supports a process known as garbage collection whereby the memory allocated to objects that are no longer used is freed up automatically. When a Java program is executed, the JVM allocates memory to the objects/variables created in the code. For example, the JVM may allocate memory to some objects declared within a method. Once the method terminates, those objects are no longer required. So, the garbage collector frees up the memory allocated to the objects within the method. The JVM periodically runs the garbage collector in the background.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q76) Which methods of Serializable interface should I implement?</strong></span></h3>
<p><strong>Ans. </strong>The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods.</p>
<h4><span style="color: #e67e23; font-size: 18px;"><strong>Q77) How can I customize the serialization process? i.e. how can one have control over the serialization process?</strong></span></h4>
<p><strong>Ans. </strong>Yes, it is possible to have control over the serialization process. The class should implement the Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q78) What is the common usage of serialization?</strong></span></h3>
<p><strong>Ans. </strong>Whenever an object is to be sent over the network, objects need to be serialized. Moreover, if the state of an object is to be saved, objects need to be serialized.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q79) What is an Externalizable interface?</strong></span></h3>
<p><strong>Ans. </strong>Externalizable is an interface that contains two methods readExternal and writeExternal. These methods give you control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by implementing these methods.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q80) When you serialize an object, what happens to the object references included in the object?</strong></span></h3>
<p><strong>Ans. </strong>The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is serialized, all the included objects are also serialized along with the original object.</p>
<p style="text-align: right;"><strong><span style="font-size: 14px; color: #000000;">Checkout: [</span><span style="color: #236fa1;"><em><span style="font-size: 14px;"><a style="color: #236fa1;" href="https://tekslate.com/exception-handling-in-java" target="_blank">Exception Handling in java</a></span></em></span><span style="font-size: 14px; color: #000000;">]</span></strong></p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q81) What one should take care of while serializing the object?</strong></span></h3>
<p><strong>Ans. </strong>One should make sure that all the included objects are also serializable. If any of the objects is not serializable then it throws a NotSerializableException.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q82) What happens to the static fields of a class during serialization?</strong></span></h3>
<p><strong>Ans. </strong>There are three exceptions in which serialization does not necessarily read and write to the stream. These are 1. Serialization ignores static fields because they are not part of a particular state. 2. Base class fields are only handled if the base class itself is serializable. 3. Transient fields</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q83) How does an exception permeate through the code?</strong></span></h3>
<p><strong>Ans. </strong>An unhandled exception moves up the method stack in search of a matching When an exception is thrown from a code that is wrapped in a try block followed by one or more catch blocks, a search is made for a matching catch block. If a matching type is found then that block will be invoked. If a matching type is not found then the exception moves up the method stack and reaches the caller method. The same procedure is repeated if the caller method is included in a try-catch block. This process continues until a catch block handling the appropriate type of exception is found. If it does not find such a block then finally the program terminates.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q84) What are the different ways to handle exceptions?</strong></span></h3>
<p><strong>Ans. </strong>There are two ways to handle exceptions, 1. By wrapping the desired code in a try block followed by a catch block to catch the exceptions. and 2. List the desired exceptions in the throws clause of the method and let the caller of the method handle those exceptions.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q85) What is the basic difference between the 2 approaches to exception handling.</strong></span></h3>
<p><strong>Ans. </strong>1&gt; try catch block and 2&gt; specifying the candidate exceptions in the throws clause?</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q86) When should you use which approach?</strong></span></h3>
<p><strong>Ans. </strong>In the first approach as a programmer of the method, you urself are dealing with the exception. This is fine if you are in the best position to decide what should be done in case of an exception. Whereas if it is not the responsibility of the method to deal with its own exceptions, then do not use this approach. In this case, use the second approach. In the second approach, we are forcing the caller of the method to catch the exceptions, that the method is likely to throw. This is often the approach library creators use. They list the exception in the throws clause and we must catch them. You will find the same approach throughout the java libraries we use.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q87) Is it necessary that each try block must be followed by a catch block?</strong></span></h3>
<p><strong>Ans. </strong>It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block OR a finally block. And whatever exceptions are likely to be thrown should be declared in the throws clause of the method.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q88) If I write return at the end of the try block, will the finally block still execute?</strong></span></h3>
<p><strong>Ans. </strong>Yes even if you write return as the last statement in the try block and no exception occurs, the finally block will execute. The final block will execute and then the control return.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q89) If I write System.exit (0); at the end of the try block, will the finally block still execute?</strong></span></h3>
<p><strong>Ans. </strong>No in this case the finally block will not execute because when you say System.exit (0); the control immediately goes out of the program, and thus finally never executes.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q90) How are the Observer and Observable used?</strong></span></h3>
<p><strong>Ans. </strong>Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.</p>
<h3><span style="font-size: 18px; color: #e67e23;"><strong>Q91) How does Java handle integer overflows and underflows?</strong></span></h3>
<p><strong>Ans. </strong>It uses those low-order bytes of the result that can fit into the size of the type allowed by the operation. &nbsp; &nbsp;</p>12:T83b3,<h2><span style="color: #e67e23; font-size: 24px;">Data Structures Interview Questions</span></h2>
<p>Data Structure and algorithm questions are important for any programming job interview, especially for java based and Data Science roles. Companies around the world invest millions of dollars in integrating their data handling systems.&nbsp;</p>
<p>Tekslate experts compiled top Data Structure and Algorithm interview questions for freshers and experienced candidates. Our <strong>Data Structure Interview Questions</strong> will help you to crack the interview and acquire your dream job.&nbsp;</p>
<div style="border-radius: 3px; background-color: #eaecf1; padding: 0 0 10px 0; margin-bottom: 20px;">
<p><span style="font-size: 13pt; color: #ffffff; padding: 10px 20px; font-weight: 600; text-align: center; border-radius: 3px; display: block; background-color: #008e81;">&nbsp;Categories of Data Structures Interview Questions</span></p>
<ul>
<li style="text-align: justify;"><span style="font-size: 12pt;"><strong><a href="#scenario"><span style="font-family: georgia, palatino, serif;">Algorithms&nbsp;</span></a><span style="font-family: georgia, palatino, serif;"><strong style="color: #000000;"><a href="#scenario"> Interview Questions</a></strong>&nbsp;</span></strong></span></li>
<li style="text-align: justify;"><span style="font-size: 12pt; font-family: georgia, palatino, serif;"><strong><a href="#advanced">Data Structures Interview Questions For Experienced</a></strong></span></li>
</ul>
</div>
<p><span style="color: #e67e23;"><strong>Q1) What is meant by Data Structure?</strong></span></p>
<p><strong>Ans:</strong> The data structure is a way that determines how to arrange and control the data. It describes the characterizes the connection between them. A few instances of Data Structures are Linked List, Stack, array, Queue, etc. Data Structures are the focal pieces of numerous computer science algorithms as they empower the developers to deal with the information effectively.</p>
<p><span style="color: #e67e23;"><strong>Q2) Describe different types of Data Structures?</strong></span></p>
<p><strong>Ans:</strong> Data Structures are classified into two types as follows:&nbsp;</p>
<ul>
<li>Linear Data Structure</li>
<li>Non-Linear Data Structure</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q3) What is meant by Linear Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A data structure is called linear if all its components are organised in the consecutive order. In linear data structures, the components are stored in a non-hierarchical level where every item has the predecessor and successor aside from the first and last component.</p>
<p><span style="color: #e67e23;"><strong>Q4) What is meant by Non-Linear Data Structure?</strong></span></p>
<p><strong>Ans:</strong> The Non-linear data structure doesn't form a sequence; for example, each component is associated with at least two different things in a non-linear arrangement. The data components are not composed in the consecutive structure.</p>
<p><span style="color: #e67e23;"><strong>Q5) List out the area of the applications of Data Structure?</strong></span></p>
<p><strong>Ans:</strong> Data Structures are applied in the following areas of Computer Science:</p>
<ul>
<li dir="ltr" aria-level="1">
<p><a href="impact-artificial-intelligence-content-marketing" target="_blank">Artificial Intelligence</a></p>
</li>
<li dir="ltr" aria-level="1">
<p>Database Management System</p>
</li>
<li dir="ltr" aria-level="1">
<p>Statistical analysis package</p>
</li>
<li dir="ltr" aria-level="1">
<p>Compiler Design</p>
</li>
<li dir="ltr" aria-level="1">
<p>Operating System</p>
</li>
<li dir="ltr" aria-level="1">
<p>Numerical Analysis</p>
</li>
<li dir="ltr" aria-level="1">
<p>Graphics</p>
</li>
<li dir="ltr" aria-level="1">
<p>Simulation</p>
</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q6) List out various Data Structures available?</strong></span></p>
<p><strong>Ans:</strong> Data Structures vary by programming languages and commonly available data structures are array, queues, stack, graphs, tree, and list.</p>
<p><span style="color: #e67e23;"><strong>Q7) What do you mean by Abstract data type?</strong></span></p>
<p><strong>Ans:</strong> A data type is a collection of a set of operations and values. Abstract data type refers to the mathematical idea that describes the data type.&nbsp;</p>
<p>It is a valuable tool for indicating the logical properties of a data type.&nbsp;</p>
<p>ADT comprises of two sections&nbsp;</p>
<p>1. Values definition&nbsp;</p>
<p>2. Operation definition&nbsp;</p>
<p>Instance:- The value definition for the ADT RATIONAL refers that RATIONAL value consists of two integers, where second doesn't mean equivalent to zero.&nbsp;</p>
<p>The operation definition for ADT RATIONAL incorporates creation (make level headed) multiplication, addition and test for correspondence.</p>
<p><span style="color: #e67e23;"><strong>Q8) List out various operations that can perform on different Data Structures?</strong></span></p>
<p><strong>Ans:</strong> Following are the various operations that can perform on different data Structures:&nbsp;</p>
<ul>
<li dir="ltr" aria-level="1">
<p>Insertion: You can add new items to the give collection of data items</p>
</li>
<li dir="ltr" aria-level="1">
<p>Deletion: You can delete or remove the data item from the given collection of data items</p>
</li>
<li dir="ltr" aria-level="1">
<p>Searching: You can find the location of the data items from the given collection of data items.&nbsp;</p>
</li>
<li dir="ltr" aria-level="1">
<p>Traversal: You can access each data item in the given collection of data items.&nbsp;</p>
</li>
<li dir="ltr" aria-level="1">
<p>Sorting: You can arrange the data items either from ascending to descending order.&nbsp;</p>
</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q9) Differentiate between storage structure and file structure?</strong></span></p>
<p><strong>Ans:</strong> Following are the key differences between Storage Structure and File Structure:</p>
<div dir="ltr" align="left">
<table><colgroup><col /><col /></colgroup>
<tbody>
<tr>
<td>
<p>Data Structure</p>
</td>
<td>
<p>File Structure</p>
</td>
</tr>
<tr>
<td>
<p>Data is stored in Ram and Disk</p>
</td>
<td>
<p>Data is stored on Disk</p>
</td>
</tr>
<tr>
<td>
<p>Customized storage policies</p>
</td>
<td>
<p>Standard File storage policies</p>
</td>
</tr>
<tr>
<td>
<p>High Compatibility with external applications</p>
</td>
<td>
<p>Low Compatibility with external applications</p>
</td>
</tr>
</tbody>
</table>
</div>
<p><span style="color: #e67e23;"><strong>Q10) What is meant by linked list in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A linear data structure or a sequence of data objects where components are collected in contiguous memory areas. The components are connected, utilizing pointers to shape a chain. Every component is a different item, called a node. Every node has two things: a data field and a reference to the next node. The entry point in a connected rundown is known as the head. The rundown is vacant, the head is an invalid reference, and the last hub has an invalid reference.&nbsp;</p>
<p>A linked list is a dynamic information structure, where the number of nodes is not fixed, and the list can develop and shrink on interest.&nbsp;</p>
<p>It is applied in situations where:&nbsp;</p>
<ul>
<li>We manage an unknown number of items or don't know the number of things on the list.&nbsp;</li>
<li>We need consistent time inclusions/cancellations from the rundown, as progressively figuring where time consistency is basic.&nbsp;</li>
<li>Arbitrary admittance to any components isn't required.&nbsp;</li>
<li>The calculation requires an information structure where items should be put away independent of their actual memory location.&nbsp;</li>
<li>We need to embed things in the rundown as in a need line.&nbsp;</li>
<li>A few usages are stacks and lines, diagrams, index of names, dynamic memory distribution, and performing number juggling procedure on whole long numbers.</li>
</ul>
<h2 id="scenario"><span style="color: #236fa1; font-size: 16pt;">Algorithms Interview Questions</span></h2>
<p><span style="color: #e67e23;"><strong>Q11) Explain various types of search methods that are available in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> There are two types of search methods that are available in Data Structure: They are as follows:</p>
<ul>
<li>Linear Search</li>
<li>Binary Search</li>
</ul>
<p><strong>Linear Search:</strong> It includes iterating over a data unit to implement the required operations.&nbsp;</p>
<p><strong>Binary search:</strong> is more proficient such that it can split the data units into chunks, and then it performs search operations on the given data elements.&nbsp;&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q12) Are linked lists considered as linear or non-linear Data Structures?</strong></span></p>
<p><strong>Ans:</strong> Linked lists are considered non-linear and linear data structures relying on the application. To access the strategies, you can utilize a linear data structure. And if you want to store the data, you can use a non-linear data structure.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q13) Give detailed information about Binary Search?</strong></span></p>
<p><strong>Ans:</strong> Binary Search a sorted array by partitioning the search interval repeatedly. The key starts checking the interval covering the whole array. If the key value is less than the middle key of the interval, it searches the lower half of the array. In any case, the key value is greater than the middle key of the interval, and then it searches the upper half of the interval. This process is repeated until the key is found in the given data set.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q14) How is the array different from the Linked list?</strong></span></p>
<p><strong>Ans:</strong> Following are the key points that differentiate the array from the linked list:&nbsp;</p>
<p><strong>Insertion and Deletion</strong>&nbsp;</p>
<p>Insertion and deletion of nodes is an easy process, as we update the address of the next pointer of a node. But it is expensive to do in the array to create the room for the new components and move existing components.&nbsp;</p>
<p><strong>Dynamic Data Structure</strong>&nbsp;</p>
<p>As a Linked list is a dynamic data structure, there is no compelling reason to give an underlying size as it can develop and contract at runtime by allocating and deallocating memory. In any case, the size is restricted in an array as the number of components is statically stored in the primary memory.&nbsp;</p>
<p><strong>No wastage of memory</strong>&nbsp;</p>
<p>As the size of a linked list can decrease or increase it depends upon the program, and memory is assigned just when needed, there is no memory squandered. On account of an exhibit, there is memory wastage. For example, if we declare the array of the size 10 and store just five components in it, then the space for five components is wasted.&nbsp;</p>
<p><strong>Implementation</strong></p>
<p>Data structures like stack and queues are more handily executed utilizing a linked list than an array.&nbsp;</p>
<p>1. A few situations where we utilize a linked list over array are:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">At the point when we know as far as possible on the number of components ahead of time&nbsp;</li>
<li dir="ltr" role="presentation">When there are an enormous number of additional or eliminate tasks&nbsp;</li>
<li dir="ltr" role="presentation">When there is no huge number of irregular admittance to components&nbsp;</li>
<li dir="ltr" role="presentation">At the point when we need to embed things in the rundown, for example, while actualizing a need line&nbsp;</li>
</ul>
<p>2. A few situations where we use array over the linked list are:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">At the point when we need to record or haphazardly access components&nbsp;</li>
<li dir="ltr" role="presentation">When we know the number of components in the exhibit already, we can designate the right measure of memory.&nbsp;</li>
<li dir="ltr" role="presentation">At the point when we need speed while emphasizing through all the components in the grouping&nbsp;</li>
<li dir="ltr" role="presentation">When memory is a worry; filled exhibits utilize less memory than connected records, as every component in the cluster is the information however each connected rundown hub requires the information just as at least one pointer to different components in the Linked list.&nbsp;</li>
</ul>
<p>In outline, we think about the prerequisites of time, space, and simplicity of usage to conclude whether to utilize a linked list or array.</p>
<p><span style="color: #e67e23;"><strong>Q15) List out various types of Linked list in the Data Structures?</strong></span></p>
<p><strong>Ans:</strong> Following are the various types of linked list in the Data Structure:</p>
<p><strong>Single Linked List:</strong> In this type of linked list, every node store the reference or address of the next node in the given list, and last node stores the next address or null values for instance 1-&gt; 2.&gt;3-&gt;4-&gt;5-&gt;Null&nbsp;</p>
<p><strong>Doubly Linked List:</strong> In this type of linked list, there are two references associated with each node. One reference point to the next node and another point refers to the previous node.&nbsp; Instance: 1&lt;-&gt;2&lt;-&gt;3&lt;-&gt;4&lt;-&gt;Null value.</p>
<p><strong>Circular Linked List:</strong> In this type of linked list, all the nodes connect to form a circle. There will be no null value in the circular linked list. Even it is a single circular or double circular linked list.&nbsp;&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q16) Explain about doubly-linked lists and give an example?</strong></span></p>
<p><strong>Ans:</strong> It is a typical type (double-linked list LL) of a linked list where a node has two connections: interfaces with the following hub in the arrangement and another that associates with the previous node. This permits crossing across the information components in the two ways.&nbsp;</p>
<p>Following are the instances:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">A music playlist with next and previous navigation buttons.</li>
<li dir="ltr" role="presentation">The program is reserved with BACK-FORWARD visited pages.&nbsp;</li>
<li dir="ltr" role="presentation">The redo and undo functionalities on a portal where you can switch the node to get to the last page</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q17) Give detailed information about the binary tree in a data structure?</strong></span></p>
<p><strong>Ans:</strong> A binary tree is a tree data structure with two nodes. In the binary tree, one root node and two nodes on the root node's left and right side. A binary tree is considered an extended linked list.&nbsp;</p>
<p>Example: Binary Tree</p>
<p><img src="https://docs.google.com/drawings/u/0/d/sPsaUCbwRjM8HMoRquH5zeQ/image?w=192&amp;h=153&amp;rev=81&amp;ac=1&amp;parent=1cWSOhGdwE7ZipuiXeV4CIMsqnMQr8riojD50Lm-iGro" alt="Binary Tree" width="192" height="153" aria-roledescription="Drawing" /></p>
<p><span style="color: #e67e23;"><strong>Q18) What is an algorithm?</strong></span></p>
<p><strong>Ans:</strong> An algorithm is a step by step technique for solving an issue or controlling data. It characterizes a set of guidelines to be executed in a specific order to get the desired output.</p>
<p><span style="color: #e67e23;"><strong>Q19) Why do you need to do an algorithm analysis?</strong></span></p>
<p><strong>Ans:</strong> A problem can be addressed in more than one way using many algorithms. Algorithm analysis assesses the necessary assets of a calculation to take care of a particular computational issue. The measure of reality assets needed to execute is likewise decided.&nbsp;</p>
<p>The time intricacy of an algorithm quantifies the measure of time taken for an analysis to run as a component of the information's length. The space complexity evaluates the measure of memory or space taken by an algorithm, to run as an element.</p>
<p><span style="color: #e67e23;"><strong>Q20) What is meant by stack in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A stack is an abstract data type that indicates a linear data structure, as in an actual stack or heaps where you can take the top items off the stack to eliminate things. Subsequently, insertion(push) and deletion(pop) of items happen just toward one side called the top of the stack, with a specific request: LIFO (Last In First Out) or FILO (First In Last Out).</p>
<p><span style="color: #e67e23;"><strong>Q21) Where can you use stacks?</strong></span></p>
<p><strong>Ans:</strong>&nbsp; Evaluation, Expression, conversion of evaluating infix, postfix, and prefix expressions</p>
<ul>
<li dir="ltr" aria-level="1">
<p>String reversal</p>
</li>
<li dir="ltr" aria-level="1">
<p>Syntax parsing</p>
</li>
<li dir="ltr" aria-level="1">
<p>Backtracking</p>
</li>
<li dir="ltr" aria-level="1">
<p>Parenthesis checking</p>
</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q22) Explain about Postfix Expression in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A postfix expression is a collection of operands and operators, where the operators are placed after the operands. The postfix expression will be as follows in the data structure.&nbsp;</p>
<p>Expression: abc+-</p>
<p>In the above expression, abc are operands, and + &amp; - are the operators.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q23) How to evaluate postfix expression using a stack data structure?</strong></span></p>
<p><strong>Ans:</strong> To evaluate postfix expression using a stack data structure using the following steps:&nbsp;</p>
<ul>
<li dir="ltr" aria-level="1">
<p>It reads all the operands and operators in the postfix expression one by one from left to right.&nbsp;</p>
</li>
<li dir="ltr" aria-level="1">
<p>Next, if the reading symbol is operand (a,b,c), it pushes the operand on to the stack.&nbsp;</p>
</li>
<li dir="ltr" aria-level="1">
<p>If the reading symbol is operator (+, -, *), then it performs pop operations on operands and the result is pushed onto the stack.&nbsp;</p>
</li>
<li dir="ltr" aria-level="1">
<p>Finally, it performs a pop operation and displays the popped value as the result.&nbsp;</p>
</li>
</ul>
<p>Example: 5 3+ 8 2 -*</p>
<ul>
<li>The above postfix expression it evaluates in the following way:&nbsp;</li>
<li>It reads the expression from the left so 5, 3. So here 5 and 3 are pushed onto the stack.&nbsp;</li>
<li>Next, it reads the operator so it performs pop operations on the operands and puts the result of the operands on to the stack.&nbsp;</li>
<li>So here the result of 5+3=8 will be pushed onto the stack.&nbsp;</li>
<li>Again it starts reads the expression, it pushes 8, 2 onto to the stack, and now it reads the operator (-) then it performs pop operation on the operands in the stack</li>
<li>Operands in the stack are 8, 8, 2. So now pop operation performs on 8, 2 and the result of the two operands is (8-2)=6</li>
<li>Now the result 6 is pushed onto the stack. And again it reads the expression.&nbsp;</li>
<li>It reads the operator * in the expression. It will perform the pop operation on the operands which are on the stack. Then 8*6= 48. And then finally it displays the result.&nbsp;&nbsp;</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q24) Explain about infix expression in the data structure?</strong></span></p>
<p><strong>Ans:</strong> A infix expression is a collection of operands and operators, where the operators are placed between the operands. The infix expression will be as follows in the data structure.&nbsp;</p>
<p>Expression: (a+b) * (c-d)</p>
<p>In the above expression a, b, c, d are operands and +, -, * are operators.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q25) Explain about prefix expression in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A prefix expression is a collection of operands and operators, where the operators are placed after the operands. The prefix expression will be as follows in the data structure.&nbsp;</p>
<p>Expression: +ab</p>
<p>In the above expression a, b are the operands and + is the operator.&nbsp;</p>
<h2 id="advanced"><span style="color: #236fa1; font-size: 16pt;">Data Structures Interview Questions For Experienced</span></h2>
<p><span style="color: #e67e23;"><strong>Q26) Explain about push and pop operation in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong>&nbsp;Both push and pop operations are used to insert and remove or delete the data from the data structure stack. The push operation indicates that users can insert or add the data into the stack. And the pop operation is used by the users to remove or delete the data from the stack. Generally, the top-most data item is considered when users perform push and pop operations on the stack.</p>
<p><span style="color: #e67e23;"><strong>Q27) Explain about Queue in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A queue is an abstract data type that defines an ordered list and linear data structure, using the First In First Out (FIFO) operation to access data items. Delete operation can be performed only at the other end called FRONT and the Insert operation can be performed only at one end called REAR.</p>
<p><span style="color: #e67e23;"><strong>Q28) List out some applications of the queue in the data structure?</strong></span></p>
<p><strong>Ans:</strong> To organize jobs as in the accompanying situations:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">A waiting list for shared resources like CPU, printer, image uploads, and call centre systems. It will process according to the FIFO (First in First out)</li>
<li dir="ltr" role="presentation">In the asynchronous transit of data, for instance, sockets, file IO, and pipe.&nbsp;</li>
<li dir="ltr" role="presentation">As buffers in applications like CD players and MP3 media players&nbsp;</li>
<li dir="ltr" role="presentation">To keep up the playlist in media players (to add or eliminate the tunes)</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q29) What is meant by dequeue in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> dequeue means double-ended queue, where the data items can insert or delete at both ends called Rear or Front.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q30) List out the operations that can perform on Queues?</strong></span></p>
<p><strong>Ans:</strong> The following operation can perform on Queue:</p>
<p><strong>dequeue():</strong> it deletes or removes the data items from the queue.</p>
<p><strong>enqueue():</strong> It inserts or adds the data items to the queue.&nbsp;</p>
<p><strong>Init():</strong> this operation is used for initializing the queue.&nbsp;</p>
<p><strong>IsEmpty():</strong> this operation is used to check whether the queue is empty or not.&nbsp;</p>
<p><strong>front():</strong> this operation is used to get the value of the queue's data item.&nbsp;</p>
<p><strong>rear():</strong> this operation is used to remove the value of the queue's data item.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q31) Explain the working of LIFO in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> LIFO means Last In First Out it is used for Stack in the Data Structure. LIFO is processing data where the last entered data item in the stack will be removed first from the stack&mdash;for instance, stacking a deck of cards by placing one card on top of the other card. If we start removing the cards from the stacking, we will first remove the topmost card. This process is called LIFO.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q32) Explain the working of FIFO in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> FIFO means First In First Out, which is used for queues in the data Structure. FIFO is processing the data where the first data item is processed first, then newly entered data item processed later. Consider a ticket counter: The person who entered first into the line(queue) will take the ticket first, and then the second person.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q33) What are the advantages of the heap over the Stack in the Data Structure?</strong></span></p>
<p><strong>Ans:</strong> Generally, both stack and heap are essential for memory and utilized in Java for various necessities:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">Heap is more adaptable than the stack since memory space can be powerfully designated and de-apportioned varying&nbsp;</li>
<li dir="ltr" role="presentation">Heap memory is utilized to store objects in Java, though stack memory is utilized to store nearby factors and capacity calls.&nbsp;</li>
<li dir="ltr" role="presentation">Items made in a heap are noticeable to all strings, while factors put away in stacks are simply obvious to the proprietor as a private memory.&nbsp;</li>
<li dir="ltr" role="presentation">When utilizing recursion, the size of storage memory is more though it rapidly fills-up stack memory.</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q34) What is the sorting algorithm in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> Sorting means arranging the information in a specific organization. Sorting algorithm indicates the best approach to orchestrate information in a specific request. Most basic requests are in numerical or lexicographical requests.&nbsp;</p>
<p>The significance of sorting lies in how information looking can be advanced to an elevated level if the information is put away in a sorted way. Sorting is likewise used to speak to information in more coherent configurations. Following are a portion of the instances of sorting, in actuality, situations.&nbsp;</p>
<p><strong>Telephone Directory:</strong> The phone registry stores the phone quantities of individuals sorted by their names so that the names can be looked for without any problem.&nbsp;</p>
<p><strong>Dictionary:</strong> The word reference stores words in a sequential request so that looking at any word becomes simple.</p>
<p><span style="color: #e67e23;"><strong>Q35) Which sorting algorithm is considered fastest in the Data Structure? Why?</strong></span></p>
<p><strong>Ans:</strong> A single sorting algorithm can't be viewed as best, as every algorithm is intended for a specific information structure and informational index. Be that as it may, the QuickSort algorithm is by and large considered the quickest because it has the best exhibition for most information sources.&nbsp;</p>
<p>Its points of interest over other sorting algorithms incorporate the accompanying:&nbsp;</p>
<p><strong>Cache-efficient:</strong> It straightly checks and directly parcels the info. This implies we can capitalize on each reserve load.&nbsp;</p>
<p><strong>Can skip some swaps:</strong> As QuickSort is somewhat touchy to include organized appropriately, it can avoid a few trades.&nbsp;</p>
<p>Proficient even in most pessimistic scenario input sets, as the request is by and mostly arbitrary.&nbsp;</p>
<p>Simple adaptation to as of now or generally arranged data sources.&nbsp;</p>
<p>At the point when speed takes need over steadiness.</p>
<p><span style="color: #e67e23;"><strong>Q36) List out top sorting algorithms in the data structure?</strong></span></p>
<p><strong>Ans:</strong> Following are the top sorting algorithms in the Data Structure:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">Insertion Sort</li>
<li dir="ltr" role="presentation">Merge Sort</li>
<li dir="ltr" role="presentation">Quick Sort</li>
<li dir="ltr" role="presentation">Bubble Sort</li>
<li dir="ltr" role="presentation">Heap Sort</li>
<li dir="ltr" role="presentation">Selection Sort</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q37) What is merge sort and how does it work?</strong></span></p>
<p><strong>Ans:</strong> Merge sort is a divide and conquers algorithm for sorting the information. It works by sorting and merging nearby information to make greater arranged records, consolidated recursively to frame considerably greater sorted records until you have one single sort list.</p>
<p><span style="color: #e67e23;"><strong>Q38) What is selection sort and how does it work?</strong></span></p>
<p><strong>Ans:</strong>&nbsp;Selection sort works by more than once picking the most modest number in rising requests from the rundown and setting it first. This cycle is continued advancing close to the furthest limit of the rundown or arranged subarray.&nbsp;</p>
<p>Scan all things and locate the littlest. Switch over the situation as the principal thing. Repeat the selection sort on the excess N-1 things. We generally repeat forward (I from 0 to N-1) and trade with the littlest component (consistently I).&nbsp;</p>
<p><strong>Time Complexity:</strong> best case O(n2); worst O(n2)&nbsp;</p>
<p><strong>Space complexity:</strong> worst O(1)</p>
<p><span style="color: #e67e23;"><strong>Q39) Define the graph in the data Structure?</strong></span></p>
<p><strong>Ans:</strong> It is a non-linear data structure consisting of vertices or nodes connected by edges or arcs to enable storage or retrieval of data. Edges may be directed or undirected.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q40) What are the applications of graphs in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> Transport frameworks where stations are spoken to as vertices and courses as the edges of the chart&nbsp;</p>
<p>Utility diagrams of intensity or water, where vertices are association focuses and edge the wires or lines interfacing them.&nbsp;</p>
<p>Interpersonal organization diagrams to decide the progression of data and hotspots (edges and vertices)&nbsp;</p>
<p>Neural organizations where vertices speak to neurons and edge the neurotransmitters between them.</p>
<p><span style="color: #e67e23;"><strong>Q41) Define the tree data structure?</strong></span></p>
<p><strong>Ans:</strong> The Tree is a recursive information structure containing at least one data node where one node is assigned as the tree's base while the excess nodes are called the root's offspring. The nodes other than the root node are apportioned into the nonempty sets where every last one is called sub-tree.</p>
<p><span style="color: #e67e23;"><strong>Q42) List out various types of trees in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> Following are various types of trees in the Data Structure:&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">General tree</li>
<li dir="ltr" role="presentation">Forests</li>
<li dir="ltr" role="presentation">Binary tree</li>
<li dir="ltr" role="presentation">Expression tree</li>
<li dir="ltr" role="presentation">Tournament tree</li>
<li dir="ltr" role="presentation">Binary search tree</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q43) What is meant by the AVL tree in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> An AVL tree is a kind of binary tree that is consistently in a condition of partially balanced. The balance is estimated as a distinction between the heights of the subtrees from the root. This self-balancing tree was known to be the first information structure to be planned.&nbsp;</p>
<p><span style="color: #e67e23;"><strong>Q44) What are the properties of B Tree in Data Structure?</strong></span></p>
<p><strong>Ans:</strong> A B tree of order n contains all the properties of an N way tree. Furthermore, it includes the accompanying properties.&nbsp;</p>
<ul>
<li dir="ltr" role="presentation">Each node in a B-Tree contains all things considered n children.&nbsp;</li>
<li dir="ltr" role="presentation">Each node in a B-Tree aside from the root node and the leaf node contain in any event n/2 children.&nbsp;</li>
<li dir="ltr" role="presentation">The root node should have in any event two nodes.&nbsp;</li>
<li dir="ltr" role="presentation">All leaf nodes should be at a similar level.</li>
</ul>
<p><span style="color: #e67e23;"><strong>Q45) What are the differences between the B tree and B+ tree?</strong></span></p>
<p><strong>Ans:</strong> Following are the key differences between B tree and B+ tree:&nbsp;</p>
<div dir="ltr" align="left">
<table style="border-collapse: collapse; width: 100%; border-style: solid;"><colgroup><col style="width: 51.4132%;" /><col style="width: 48.5854%;" /></colgroup>
<tbody>
<tr>
<td>
<p><strong>B Tree</strong></p>
</td>
<td>
<p><strong>B+ Tree</strong></p>
</td>
</tr>
<tr>
<td>
<p>Search keys cannot regularly be stored.</p>
</td>
<td>
<p style="text-align: left;">Excessive search keys can be present.</p>
<br /><br /></td>
</tr>
<tr>
<td>
<p>Data can be stored in internal nodes as well as leaf nodes.</p>
<br /><br /></td>
<td>
<p style="text-align: left;">Data only stored on the leaf nodes.</p>
<br /><br /></td>
</tr>
<tr>
<td>
<p>Searching the information is a more slow cycle since data can be found on leaf nodes and the internal nodes.</p>
<br /><br /></td>
<td>
<p style="text-align: left;">Searching is nearly quicker as information must be found on the leaf nodes.</p>
</td>
</tr>
<tr>
<td>
<p>Deletion of internal nodes is so time-consuming and complicated.</p>
<br /><br /></td>
<td>
<p style="text-align: left;">Deletion will never be a complex method since elements will always be deleted from the leaf nodes.</p>
<br /><br /></td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>13:T35a8,<p><strong style="text-align: justify;">What is a transient variable?</strong></p>
<p style="text-align: justify;">A transient variable is a variable that may not be serialized.</p>
<p style="text-align: justify;"><strong> Which containers use a border Layout as their default layout?</strong></p>
<p style="text-align: justify;">The&nbsp;Window,&nbsp;Frame&nbsp;and&nbsp;Dialog&nbsp;classes use a border layout as their default layout.</p>
<p style="text-align: justify;"><strong> Why do threads block on I/O?</strong></p>
<p style="text-align: justify;">Threads block on I/O (that is enters the waiting state) so that other threads may execute while the I/O Operation is performed.</p>
<p style="text-align: justify;"><strong> How are Observer and Observable used?</strong></p>
<p style="text-align: justify;">Objects that subclass the&nbsp;Observable&nbsp;class maintain a list of observers. When an&nbsp;Observable&nbsp;object is updated it invokes the&nbsp;update()&nbsp;method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe&nbsp;Observable&nbsp;objects.</p>
<p style="text-align: justify;"><strong> What is synchronization and why is it important?</strong></p>
<p style="text-align: justify;">With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors.</p>
<p style="text-align: justify;"><strong> Can a lock be acquired on a class?</strong></p>
<p style="text-align: justify;">Yes, a lock can be acquired on a class. This lock is acquired on the class's&nbsp;Class&nbsp;object..</p>
<p style="text-align: justify;"><strong> What's new with the stop(), suspend() and resume() methods in JDK 1.2?</strong></p>
<p style="text-align: justify;">The&nbsp;stop(),&nbsp;suspend()&nbsp;and&nbsp;resume()&nbsp;methods have been deprecated in JDK 1.2.</p>
<p style="text-align: justify;"><strong> Is null a keyword?</strong></p>
<p style="text-align: justify;">The&nbsp;null&nbsp;is not a keyword.</p>
<p style="text-align: justify;"><strong> What is the preferred size of a component?</strong></p>
<p style="text-align: justify;">The preferred size of a component is the minimum component size that will allow the component to display normally.</p>
<p style="text-align: justify;"><strong> What method is used to specify a container's layout?</strong></p>
<p style="text-align: justify;">The&nbsp;setLayout()&nbsp;method is used to specify a container's layout.</p>
<p style="text-align: justify;"><strong> Which containers use a FlowLayout as their default layout?</strong></p>
<p style="text-align: justify;">The&nbsp;Panel&nbsp;and&nbsp;Applet&nbsp;classes use the&nbsp;FlowLayout&nbsp;as their default layout.</p>
<p style="text-align: justify;"><strong> What state does a thread enter when it terminates its processing?</strong></p>
<p style="text-align: justify;">When a thread terminates its processing, it enters the dead state.</p>
<p style="text-align: justify;"><strong> What is the Collections API?</strong></p>
<p style="text-align: justify;">The Collections API is a set of classes and interfaces that support operations on collections of objects.</p>
<p style="text-align: justify;"><strong> Which characters may be used as the second character of an identifier, but not as the first character of an identifier?</strong></p>
<p style="text-align: justify;">The digits 0 through 9 may not be used as the first character of an identifier but they may be used after the first character of an identifier.</p>
<p style="text-align: justify;"><strong> What is the List interface?</strong></p>
<p style="text-align: justify;">The&nbsp;<span style="background-color: #ffffff; color: #000000;">List</span>&nbsp;interface provides support for ordered collections of objects.</p>
<p style="text-align: justify;"><strong> How does Java handle integer overflows and underflows?</strong></p>
<p style="text-align: justify;">It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.</p>
<p style="text-align: justify;"><strong> What is the Vector class?</strong></p>
<p style="text-align: justify;">The&nbsp;Vector&nbsp;class provides the capability to implement a growable array of objects</p>
<p style="text-align: justify;"><strong> What modifiers may be used with an inner class that is a member of an outer class?</strong></p>
<p style="text-align: justify;">A (non-local) inner class may be declared as&nbsp;public,&nbsp;protected,&nbsp;private,&nbsp;static,&nbsp;final, or&nbsp;abstract.</p>
<p style="text-align: justify;"><strong> What is an Iterator interface?</strong></p>
<p style="text-align: justify;">The&nbsp;Iterator&nbsp;interface is used to step through the elements of a Collection.</p>
<p style="text-align: justify;"><strong> What is the difference between the &gt;&gt; and &gt;&gt;&gt; operators?</strong></p>
<p style="text-align: justify;">The&nbsp;&gt;&gt;&nbsp;operator carries the sign bit when shifting right. The&nbsp;&gt;&gt;&gt;&nbsp;zero-fills bits that have been shifted out.</p>
<p style="text-align: justify;"><strong> Which method of the Component class is used to set the position and size of a component?</strong></p>
<p style="text-align: justify;">setBounds()&nbsp;method is used to set the position and size of a component.</p>
<p style="text-align: justify;"><strong> What is the difference between yielding and sleeping?</strong></p>
<p style="text-align: justify;">When a task invokes its&nbsp;yield()&nbsp;method, it returns to the ready state. When a task invokes its&nbsp;sleep()&nbsp;method, it returns to the waiting state.</p>
<p style="text-align: justify;"><strong> Which java.util classes and interfaces support event handling?</strong></p>
<p style="text-align: justify;">The&nbsp;EventObject&nbsp;class and the&nbsp;EventListener&nbsp;interface support event processing.</p>
<p style="text-align: justify;"><strong> Is sizeof a keyword?</strong></p>
<p style="text-align: justify;">The&nbsp;sizeof&nbsp;operator is not a keyword.</p>
<p style="text-align: justify;"><strong> What are wrapped classes?</strong></p>
<p style="text-align: justify;">Wrapped classes are classes that allow primitive types to be accessed as objects.</p>
<p style="text-align: justify;"><strong> Does garbage collection guarantee that a program will not run out of memory?</strong></p>
<p style="text-align: justify;">Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.</p>
<p style="text-align: justify;"><strong> What restrictions are placed on the location of a package statement within a source code file?</strong></p>
<p style="text-align: justify;">A package statement must appear as the first line in a source code file (excluding blank lines and comments).</p>
<p style="text-align: justify;"><strong> Can an object's finalize() method be invoked while it is reachable?</strong></p>
<p style="text-align: justify;">An object's&nbsp;finalize()&nbsp;method cannot be invoked by the garbage collector while the object is still reachable. However, an object's&nbsp;finalize()&nbsp;method may be invoked by other objects.</p>
<p style="text-align: justify;"><strong> What is the immediate superclass of the Applet class?</strong></p>
<p style="text-align: justify;">Panel.</p>
<p style="text-align: justify;"><strong> What is the difference between preemptive scheduling and time slicing?</strong></p>
<p style="text-align: justify;">Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.</p>
<p style="text-align: justify;"><strong> Name three Component subclasses that support painting.</strong></p>
<p style="text-align: justify;">The&nbsp;Canvas,&nbsp;Frame,&nbsp;Panel, and&nbsp;Applet&nbsp;classes support painting.</p>
<p style="text-align: justify;"><strong> What value does readLine() return when it has reached the end of a file?</strong></p>
<p style="text-align: justify;">The&nbsp;readLine()&nbsp;method returns&nbsp;null&nbsp;when it has reached the end of a file.</p>
<p style="text-align: justify;"><strong> What is the immediate superclass of the Dialog class?</strong></p>
<p style="text-align: justify;">Window.</p>
<p style="text-align: justify;"><strong> What is clipping?</strong></p>
<p style="text-align: justify;">Clipping is the process of confining paint operations to a limited area or shape.</p>
<p style="text-align: justify;"><strong> What is a native method?</strong></p>
<p style="text-align: justify;">A native method is a method that is implemented in a language other than Java.</p>
<p style="text-align: justify;"><strong> Can a for statement loop indefinitely?</strong></p>
<p style="text-align: justify;">Yes, a for statement can loop indefinitely. For example, consider the following:</p>
<p style="text-align: justify;">for(;;) ;</p>
<p style="text-align: justify;"><strong> What are order of precedence and associativity, and how are they used?</strong></p>
<p style="text-align: justify;">Order of precedence determines the order in which operators are evaluated in expressions.</p>
<p style="text-align: justify;">Associatity determines whether an expression is evaluated left-to-right or right-to-left.</p>
<p style="text-align: justify;"><strong> When a thread blocks on I/O, what state does it enter?</strong></p>
<p style="text-align: justify;">A thread enters the waiting state when it blocks on I/O.</p>
<p style="text-align: justify;"><strong> To what value is a variable of the String type automatically initialized?</strong></p>
<p style="text-align: justify;">The default value of an&nbsp;String&nbsp;type is&nbsp;null.</p>
<p style="text-align: justify;"><strong> What is the catch or declare rule for method declarations?</strong></p>
<p style="text-align: justify;">If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.</p>
<p style="text-align: justify;"><strong> What is the difference between a MenuItem and a CheckboxMenuItem?</strong></p>
<p style="text-align: justify;">The&nbsp;CheckboxMenuItem&nbsp;class extends the&nbsp;MenuItem&nbsp;class to support a menu item that may be checked or unchecked.</p>
<p style="text-align: justify;"><strong> What is a task's priority and how is it used in scheduling?</strong></p>
<p style="text-align: justify;">A task's priority is an integer value that identifies the relative order in which it should be executed with respect to other tasks. The scheduler attempts to schedule higher priority tasks before lower priority tasks.</p>
<p style="text-align: justify;"><strong> What class is the top of the AWT event hierarchy?</strong></p>
<p style="text-align: justify;">The&nbsp;java.awt.AWTEvent&nbsp;class is the highest-level class in the AWT event-class hierarchy.</p>
<p style="text-align: justify;"><strong> When a thread is created and started, what is its initial state?</strong></p>
<p style="text-align: justify;">A thread is in the ready state after it has been created and started.</p>
<p style="text-align: justify;"><strong> Can an anonymous class be declared as implementing an interface and extending a class?</strong></p>
<p style="text-align: justify;">An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.</p>
<p style="text-align: justify;"><strong> What is the immediate superclass of Menu?</strong></p>
<p style="text-align: justify;">MenuItem.</p>
<p style="text-align: justify;"><strong> What is the purpose of finalization?</strong></p>
<p style="text-align: justify;">The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.</p>
<p style="text-align: justify;"><strong> Which class is the immediate superclass of the MenuComponent class?</strong></p>
<p style="text-align: justify;">Object.</p>
<p style="text-align: justify;"><strong> What invokes a thread's run() method?</strong></p>
<p style="text-align: justify;">After a thread is started, via its&nbsp;start()&nbsp;method or that of the&nbsp;Thread&nbsp;class, the JVM invokes the thread's&nbsp;run()method when the thread is initially executed.</p>
<p style="text-align: justify;"><strong> What is the difference between the Boolean &amp; operator and the &amp;&amp; operator?</strong></p>
<p style="text-align: justify;">If an expression involving the Boolean&nbsp;&amp;&nbsp;operator is evaluated, both operands are evaluated. Then the&nbsp;&amp;&nbsp;operator is applied to the operand. When an expression involving the&nbsp;&amp;&amp;&nbsp;operator is evaluated, the first operand is evaluated.</p>
<p style="text-align: justify;">If the first operand returns a value of true then the second operand is evaluated. The&nbsp;&amp;&amp;&nbsp;operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.</p>
<p style="text-align: justify;">&nbsp;</p>14:T6d22,<h2 style="text-align: left;"><span style="font-size: 24px; color: #e67e23;"><strong>Core Java Interview Questions and Answers</strong></span></h2>
<h3><span style="font-size: 12pt; color: #e03e2d;"><strong><span style="color: #e67e23;">Q1) Which two methods you need to implement for key Object in</span> <span style="color: #3598db;"><span style="color: #e67e23;">HashMap?</span></span></strong></span></h3>
<p><strong>Ans:</strong>&nbsp; To use any object as a Key in HashMap, it must implement equals and hashcode method in Java. Read <strong>How HashMap works in Java </strong>for a detailed explanation of how the equals and hashcode method is used to put and get an object from HashMap.</p>
<h3><span style="color: #e67e23; font-size: 12pt;"><strong>Q2) What is an immutable object? Can you write an immutable object?</strong></span></h3>
<p><strong>Ans:</strong>&nbsp; Immutable classes are Java classes whose objects can not be modified once created. Any modification in an Immutable object results in a new object. For example, is String is immutable in Java. Mostly Immutable are also final in Java, to prevent sub class from overriding methods in Java which can compromise Immutability. You can achieve the same functionality by making members nonfinal but private and not modifying them except in the constructor.</p>
<h3><span style="color: #e67e23; font-size: 12pt;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q3) What is the difference between creating String as new() and literal?</span></strong></span></h3>
<p><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; When we create a string with a new() Operator, it&rsquo;s created in the heap and not added into the string pool while String created using literal are created in the String pool itself which exists in the PermGen area of the heap.</span></p>
<p><span style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">String s = new String("Test");</span> </span></p>
<p><span style="font-style: inherit; font-weight: inherit;">does not put the object in the String pool, we need to call String.intern() method which is used to put them into the String pool explicitly. it's only when you create a String object as String literal e.g. String s = "Test" Java automatically put that into the String pool.</span></p>
<h3><span style="color: #e03e2d; font-size: 12pt;"><strong style="line-height: 1.5;"><span style="color: #e67e23;">Q4) What is the difference between StringBuffer and StringBuilder in Java?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; Classic Java questions which some people think tricky and some consider very easy. StringBuilder in Java is introduced in Java 5 and the only difference between both of them is that StringBuffer methods are synchronized while StringBuilder is non synchronized. See StringBuilder vs StringBuffer for more differences.</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q5) Write code to find the First non repeated character in the String?</span></strong></span></h3>
<p><span style="font-style: inherit; font-weight: inherit;"><strong><span style="color: #000000;">Ans:&nbsp;</span></strong> Another good Java interview question, This question is mainly asked by Amazon and equivalent companies. See first non repeated character in the string: Amazon interview question</span></p>
<h3><span style="font-size: 12pt; color: #e03e2d;"><strong style="font-style: inherit; line-height: 1.5;"><span style="color: #e67e23;">Q6) What is the difference between</span> <span style="color: #3598db;"><span style="color: #e67e23;">ArrayList</span> </span><span style="color: #e67e23;">and Vector?</span></strong><span style="color: #e67e23;"> </span></span></h3>
<p><span style="color: #000000;"><strong>Ans:</strong>&nbsp;</span> This question is mostly used as a start up question in Technical interviews on the topic of Collection framework. The answer is explained in detail here the Difference between ArrayList and Vector.</p>
<h3><span style="font-size: 12pt; color: #e03e2d;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;"><span style="color: #e67e23;">Q7) How do you handle error conditions while writing a</span><span style="color: #3598db;"> <span style="color: #e67e23;">stored procedure</span></span> <span style="color: #e67e23;">or accessing a stored procedure from java?</span></span></strong></span></h3>
<p><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; This is one of the tough Java interview questions and it's open for all, my friend didn't know the answer so he didn't mind telling me. my take is that stored procedure should return an error code if some operation fails but if the stored procedure itself fails then catching SQLException is the only choice.</span></p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q8) What is difference between Executor.submit() and Executer.execute() method ?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; There is a difference when looking at exception handling. If your tasks throw an exception and if it was submitted with executing this exception will go to the uncaught exception handler (when you don't have provided one explicitly, the default one will just print the stack trace to System.err). If you submitted the task with submitting any thrown exception, checked exception or not, is then part of the task's return status. For a task that was submitted with&nbsp;submitting&nbsp;and that terminates with an exception, the Future.get will re-throw this exception, wrapped in an&nbsp;ExecutionException.</span></span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q9) What is the difference between factory and abstract factory pattern?</span></strong></span></h3>
<p><strong>Ans:</strong></p>
<ul>
<li><span style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">Abstract Factory provides one more level of abstraction. Consider different factories each extended from an Abstract Factory and responsible for the creation of different hierarchies of objects based on the type of factory. E.g. Abstract Factory extended by Automobile Factory, UserFactory, Role Factory, etc. Each factory would be responsible for the creation of objects in that genre.</span></span></li>
<li><span style="font-style: inherit; font-weight: inherit;">You can also refer to What is Factory method design pattern in Java&nbsp;to know more details.</span></li>
</ul>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q10) What is Singleton? is it better to make the whole method synchronized or only the critical section synchronized?</span></strong></span></h3>
<p><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:&nbsp;</strong> Singleton in Java is a class with just one instance in the whole Java application, for example, java.lang.Runtime is a Singleton class. Creating Singleton was tricky before Java 4 but once Java 5 introduced Enum it's very easy. see my article How to create thread-safe Singleton in Java for more details on writing Singleton using enum and double-checked locking which is the purpose of this Java interview question.</span></p>
<h3><span style="color: #e67e23; font-size: 12pt;"><strong style="line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q11) Can you write a critical section code for singleton?</span></strong></span></h3>
<p><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; This core Java question is a follow-up of the previous question and expecting a candidate to write Java singleton using double-checked locking. Remember to use volatile variables to make Singleton thread-safe.</span></p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q12) Can you write code for iterating over hashmap in Java 4 and Java 5?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; Tricky one but he managed to write using a while and for a loop.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q13) When do you override hashcode and equals()?</strong> </span></h3>
<p><strong>Ans:</strong> Whenever necessary especially if you want to do an equality check or want to use your object as a key in HashMap.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q14) What will be the problem if you don't override the hashcode() method?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; You will not be able to recover your object from hash Map if that is used as a key in HashMap. See here&nbsp;&nbsp;How HashMap works in Java for a detailed explanation.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q15) Is it better to synchronize critical section of getInstance() method or whole getInstance() method ?</strong></span></h3>
<p><strong>Ans:</strong>&nbsp; The answer is a critical section because if we lock the whole method than every time someone calls this method will have to wait even though we are not creating any object)</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q16) What is the difference when String is gets created using a literal or new() operator?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; When we create a string with new() its created in the heap and not added into the string pool while String created using literal are created in the String pool itself which exists in the Perm area of the heap.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q17) Does not override the hashcode() method has any performance implication?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; This is a good question and opens to all, as per my knowledge, a poor hashcode function will result in frequent collision in HashMap which eventually increases the time for adding an object into Hash Map.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q18) What&rsquo;s wrong with using HashMap in a multithreaded environment? When get() method go to an infinite loop?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; Another good question. His answer was during concurrent access and re-sizing.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong><span style="font-style: inherit; font-weight: inherit;">Q19) What do you understand by thread-safety? Why is it required? And finally, how to achieve thread-safety in Java Applications?</span></strong> </span></h3>
<p><span style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; </span></span></p>
<ul>
<li><span style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">Java</span> <span style="font-style: inherit; font-weight: inherit;">Memory Model defines the legal interaction of threads with the memory in a real computer system. In a way, it describes what behaviors are legal in multi-threaded code. It determines when a Thread can reliably see writes to variables made by other threads. It defines semantics for volatile, final &amp; synchronized, which makes guarantee visibility of memory operations across the Threads.</span></span></li>
<li><span style="font-style: inherit; font-weight: inherit;">Let's first discuss Memory Barrier which is the base for our further discussions. There are two types of memory barrier instructions in JMM:</span></li>
</ul>
<p><span style="font-style: inherit; font-weight: inherit;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1. Read barriers&nbsp;</span></p>
<p><span style="font-style: inherit; font-weight: inherit;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2. Write barriers.</span></p>
<ul>
<li><span style="font-style: inherit; font-weight: inherit;">A read barrier invalidates the local memory (cache, registers, etc) and then reads the contents from the main memory so that changes made by other threads become visible to the current Thread.</span></li>
<li><span style="font-style: inherit; font-weight: inherit;">A write barrier flushes out the contents of the processor's local memory to the main memory, so that changes made by the current Thread becomes visible to the other threads.</span></li>
</ul>
<blockquote>
<p style="text-align: center;"><em>Inclined to build a profession as core java training? Then here is the blog post on, explore <a title="core java training" href="https://tekslate.com/core-java-training" target="_blank"><span style="color: #e03e2d;"><strong>core java training</strong></span></a></em></p>
</blockquote>
<h2><span style="font-size: 14pt; color: #e67e23;"> <strong>JMM semantics for synchronized</strong> </span></h2>
<p><span style="font-style: inherit; font-weight: inherit;">When a thread acquires a monitor of an object, by entering into a synchronized block of code, it performs a read barrier (invalidates the local memory and reads from the heap instead). Similarly exiting from a synchronized block as part of releasing the associated monitor, it performs a write barrier (flushes changes to the main memory)</span> <span style="font-style: inherit; font-weight: inherit;">Thus modifications to a shared state using synchronized block by one Thread, are guaranteed to be visible to subsequent synchronized reads by other threads. This guarantee is provided by JMM in presence of a synchronized code block.</span></p>
<h2><span style="font-size: 14pt; color: #e67e23;"> <strong>JMM semantics for Volatile &nbsp;fields</strong> </span></h2>
<p><span style="font-style: inherit; font-weight: inherit;">Read &amp; write to volatile variables have the same memory semantics as that of acquiring and releasing a monitor using a synchronized code block. So the visibility of the volatile field is guaranteed by the JMM. Moreover afterward Java 1.5, volatile reads and writes are not reorderable with any other memory operations (volatile and non-volatile both). Thus when Thread A writes to a volatile variable V, and afterward Thread B reads from variable V, any variable values that were visible to A at the time V was written are guaranteed now to be visible to B.</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">Let's try to understand the same using the following code</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">Data data = null;</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">volatile boolean flag = false;</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">Thread A</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">-------------</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">data = new Data();</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">flag = true;<span style="font-style: inherit; font-weight: inherit;"> <span style="font-style: inherit; font-weight: inherit;"> &lt;</span></span><span style="font-style: inherit; font-weight: inherit;">-- writing to volatile will flush data as well as a flag to main memory</span></span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">Thread B</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">-------------</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">if(flag==true){ <span style="font-style: inherit; font-weight: inherit;">&lt;-- as="" barrier="" data.="" flag="" font="" for="" from="" perform="" read="" reading="" volatile="" well="" will=""&gt;</span></span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">use data; <span style="font-style: inherit; font-weight: inherit;">&lt;!--- data is guaranteed to visible even though it is not declared volatile because of the JMM&nbsp;semantics of volatile flag.</span></span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong><span style="font-style: inherit; font-weight: inherit;">Q20) What will happen if you call return statement or System.exit on the try or catch block? will finally block execute?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; This is a very <em>popular tricky Java question</em> and it's tricky because many programmers think that finally block always executed. This question challenge that concept by putting a return statement in try or catch block or calling System.exit from try or catch block. The answer to this tricky question in Java is that finally block will execute even if you put a return statement in the try block or catch block but finally block won't run if you call System.exit from trying or catch.</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q21) Can you override private or static methods in Java?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; Another popular Java tricky question, As I said method overriding is a good topic to ask trick questions in Java.&nbsp;&nbsp;Anyway, you can not override private or static method in Java, if you create a similar method with the same return type and same method arguments that are called method hiding.</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q22) What will happen if we put a key object in a HashMap which is already there?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:&nbsp;</strong> This tricky Java question is part of How HashMap works in Java, which is also a popular topic to create confusing and tricky questions in Java. well if you put the same key again then it will replace the old mapping because HashMap doesn't allow duplicate keys.&nbsp;</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q23) If a method throws NullPointerException in the superclass, can we override it with a method that throws RuntimeException?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; One more tricky Java question from overloading and overriding concept. The answer is you can very well throw superclass of RuntimeException in the overridden method but you can not do the same if it's checked Exception.&nbsp;</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q24) What is the issue with the following implementation of the compareTo() method in Java</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:&nbsp;</strong> public int compareTo(Object o)</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Employee emp = (Employee) emp;</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return this.id - o.id;</span></p>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q25) How do you ensure that the N thread can access N resources without deadlock?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:</strong>&nbsp; If you are not well versed in writing multi-threading code</span><span style="font-style: inherit; font-weight: inherit;"> then this is a really tricky question for you. This Java question can be tricky even for the experienced and senior programmers, who are not really exposed to deadlock and race conditions. The key point here is order, if you acquire resources in a particular order and release resources in the reverse</span><span style="font-style: inherit; font-weight: inherit;">&nbsp;order you can prevent deadlock.&nbsp;</span></span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q26) What is the difference between CyclicBarrier and CountDownLatch in Java?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:&nbsp;</strong> Relatively newer Java tricky question, only been introduced from Java 5. The main difference between both of them is that you can reuse CyclicBarrier even if the Barrier is broken but you can not reuse CountDownLatch in Java. See CyclicBarrier vs CountDownLatch in Java for more differences.</span></p>
<h3 style="font-style: inherit; font-weight: inherit;"><span style="font-size: 12pt; color: #e67e23;"><strong style="font-style: inherit; line-height: 1.5;"><span style="font-style: inherit; font-weight: inherit;">Q27) Can you access nonstatic variables in a static context?</span></strong></span></h3>
<p style="font-style: inherit; font-weight: inherit;"><span style="font-style: inherit; font-weight: inherit;"><strong>Ans:&nbsp;</strong> Another tricky Java question from Java fundamentals. No, you can not access static variables in the nonstatic context in Java. Read why you can not access the non-static variables from a static method to learn more about these tricky Java questions.</span></p>
<h3 class="h3"><span style="font-size: 12pt; color: #e67e23;"><strong>Q28) How many types of memory areas are allocated by JVM?</strong></span></h3>
<p><strong>Ans:</strong>&nbsp; Many types:</p>
<ul>
<li>Class(Method) Area</li>
<li>Heap</li>
<li>Stack</li>
<li>Program Counter Register</li>
<li>Native Method Stack</li>
</ul>
<h3 class="h3"><span style="font-size: 12pt; color: #e67e23;"><strong>Q29) What is the JIT compiler?</strong></span></h3>
<p><span style="color: #e03e2d;"><strong><span style="color: #000000;">Ans:</span> <span style="color: #000000;">Just-In-Time(JIT) compiler: </span></strong></span>It is used to improve performance. JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation. Here the term &ldquo;compiler&rdquo; refers to a translator from the instruction set of a Java virtual machine (JVM) to the instruction set of a specific CPU.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q30) What is a platform?</strong></span></h3>
<p><strong>Ans:&nbsp;</strong> A platform is basically the hardware or software environment in which a program runs. There are two types of platforms software-based and hardware-based. Java provides a software-based platform.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q31) What is the main difference between the Java platform and other platforms?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; The Java platform differs from most other platforms in the sense that it's a software-based platform that runs on top of other hardware-based platforms. It has two components:</p>
<ul>
<li>Runtime Environment</li>
<li>API (Application Programming Interface)</li>
</ul>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q32) What gives Java its 'write once and run anywhere' nature?</strong> </span></h3>
<p><strong>Ans:&nbsp;</strong> The bytecode. Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platform specific and hence can be fed to any platform.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q33) What is a static variable?</strong></span></h3>
<p><strong>Ans:&nbsp;</strong> A static variable is used to refer to the common property of all objects (that is not unique for each object) e.g. company name of employees, college name of students, etc. static variable gets memory only once in the class area at the time of class loading. more details.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q34) What is a static method?</strong> </span></h3>
<p><strong>Ans:</strong>&nbsp; A static method belongs to the class rather than the object of a class. A static method can be invoked without the need for creating an instance of a class. a static method can access static data member and can change the value of it. more details.</p>
<h3><span style="color: #e67e23; font-size: 12pt;"><strong>Q35) Why the main method is static?</strong></span></h3>
<p><strong>Ans:</strong>&nbsp; Because the object is not required to call a static method if It were a non-static method, JVM creates an object first then calls a main() method that will lead to the problem of extra memory allocation more details.</p>
<h3><span style="font-size: 12pt; color: #e67e23;"><strong>Q36) What is a static block?</strong> </span></h3>
<p><strong>Ans: </strong>This is&nbsp;used to initialize the static data member. It is executed before the main method at the time of classloading.</p>
<p style="text-align: center;"><a style="background-color: #e94350; color: #ffffff; padding: 10px 20px;" title="Core Java Tutorials" href="https://tekslate.com/core-java-tutorials" target="_blank">Core Java Tutorials</a></p>15:Tccc,<p>&nbsp;</p>
<h2><span style="font-size: 14pt; color: #e67e23;">Released&nbsp; History of MVC</span></h2>
<table style="height: 253px;" width="568">
<tbody>
<tr>
<td width="170"><span style="font-size: 12pt;"><strong>Date</strong></span></td>
<td width="170"><span style="font-size: 12pt;"><strong>Version</strong></span></td>
</tr>
<tr>
<td width="170"><span style="font-size: 12pt;">10-Dec-2007</span></td>
<td width="170"><span style="font-size: 12pt;">Asp.net MVC CTP</span></td>
</tr>
<tr>
<td width="170"><span style="font-size: 12pt;">13-March-2009</span></td>
<td width="170"><span style="font-size: 12pt;">Asp.net MVC 1.0</span></td>
</tr>
<tr>
<td width="170"><span style="font-size: 12pt;">10-March-2010</span></td>
<td width="170"><span style="font-size: 12pt;">Asp.net MVC 2.0</span></td>
</tr>
<tr>
<td width="170"><span style="font-size: 12pt;">13-Jan-2011</span></td>
<td width="170"><span style="font-size: 12pt;">Asp.net MVC 3.0</span></td>
</tr>
<tr>
<td width="170"><span style="font-size: 12pt;">15-Aug-2012</span></td>
<td width="170"><span style="font-size: 12pt;">Asp.net MVC 4.0</span></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<ul>
<li><span style="font-size: 12pt;">The meter charge in MVC 3 is a new engine that is added razor vie engine.</span></li>
<li><span style="font-size: 12pt;">Instead of c # code in view, we can also use razor view engine</span></li>
</ul>
<p><span style="font-size: 12pt;">&nbsp; <img class="alignnone wp-image-6041" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/112.png" alt="1" width="189" height="259" /></span></p>
<blockquote>
<p><em><strong>Interested in mastering "<span style="color: #e03e2d;"><a style="color: #e03e2d;" href="asp-dot-net-training" target="_blank" rel="noopener">ASP.Net Training</a></span>"? Check out this blog post to learn more ASP.Net Tutorials.</strong></em></p>
</blockquote>
<p><span style="font-size: 12pt;"><img class="alignnone size-full wp-image-6042" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/211.png" alt="2" width="198" height="280" /> </span></p>
<p><span style="font-size: 12pt;">In 3.0 we also can support to was with HTML 5 version. </span></p>
<p><span style="font-size: 12pt; color: #e67e23;"><strong>For in-depth understanding click on:</strong></span></p>
<ul>
<li><span style="font-size: 12pt;"><a href="http://tekslate.com/difference-asp-net-web-applications-asp-net-mvc-application/" target="_blank" rel="noopener">ASP. NET web applications and ASP. NET MVC Application.</a></span></li>
<li><span style="font-size: 12pt;"><a href="http://tekslate.com/object-initialization-asp-net/" target="_blank" rel="noopener">Object initialization</a></span></li>
<li><span style="font-size: 12pt;"><a href="http://tekslate.com/example-razor-syntax-data-type-comparison-methods/" target="_blank" rel="noopener">Razor syntax</a></span></li>
<li><span style="font-size: 12pt;"><a href="http://tekslate.com/collection-initialize-asp-net/" target="_blank" rel="noopener">Collection Initialize ASP.net</a></span></li>
<li><span style="font-size: 12pt;"><a href="http://tekslate.com/view-engine-razor-view-engine/" target="_blank" rel="noopener">View engine &amp; Razor view engine</a></span></li>
</ul>16:Tecc,<p>&nbsp;</p>
<h2><span style="font-size: 14pt; color: #e03e2d;">Core Java Sample Resume</span></h2>
<p>34, Main Street, Seattle, Washington. (856) 589 785. antony@yahoo.com.</p>
<h2><span style="font-size: 14pt; color: #e03e2d;">Professional Summary:</span></h2>
<ul>
<li>Seeking a position in a Java developer in an IT organization, where to use my skills in Java programming.</li>
<li>Having work experience in complete Java Package.</li>
<li>Having the ability to work and handle different projects simultaneously.</li>
<li>Designing and development of various software tools.</li>
<li>Proven analytical and technical skills, creating new software systems and coding for modules while structuring hardware and networking solutions to meet customer's needs.</li>
<li>Good understanding of the SDLC process and experience in involving development documentation.</li>
</ul>
<p><span style="font-size: 14pt; color: #e03e2d;"><strong>Technical Strengths:</strong></span></p>
<ul>
<li>Programming languages: C, C++, Javascript.</li>
<li>Operating systems: Linux, Unix, MS-DOS.</li>
<li>Database: Oracle 11g, SQL server.</li>
<li>Web server: Apache Tomcat.</li>
</ul>
<blockquote>
<p style="text-align: center;"><em>Inclined to build a profession as Core Java Tutorials? Then here is the blog post on, explore<a href="core-java-tutorials" target="_blank" rel="noopener"> <span style="color: #e03e2d;"><strong>Core Java Tutorials</strong></span></a></em></p>
</blockquote>
<p><span style="font-size: 14pt; color: #e03e2d;"><strong>Educational Qualifications:</strong></span></p>
<ul>
<li>Bachelor of Engineering in Computer Science, Brenau, Australia.</li>
<li>Masters in Computer Applications, University of Sydney, Australia.</li>
</ul>
<h2><span style="font-size: 14pt; color: #e03e2d;"><strong>Professional Experience:</strong></span></h2>
<ul>
<li>Having 3 years of experience as a core java developer in Westpac Group, Australia.</li>
</ul>
<p><span style="color: #e03e2d; font-size: 14pt;"><strong>Duties and Responsibilities:</strong></span></p>
<ul>
<li>Writing test cases and test plans for the build screen in Mercury Quality center.</li>
<li>Interacting with clients on business requirements and scope of the project.</li>
<li>Involved in the development of safety components in the electronic banking website for JSP pages.</li>
<li>Involved in the development of several Java components for flash-based games on the Android platform.</li>
<li>Involved in designing animated graphics for gaming and social networking sites on J2EE.</li>
<li>Developed an enterprise java ecosystem in collaboration with the development team.</li>
</ul>
<p><span style="font-size: 14pt; color: #e03e2d;"><strong>Accomplishments:</strong></span></p>
<ul>
<li>Handled a team of 3 members.</li>
<li>Troubleshooting the issues and finding the defects.</li>
</ul>
<blockquote>
<p style="text-align: center;"><em>Inclined to build a profession as Core Java Interview Questions? Then here is the blog post on, explore <a title="Core Java Interview Questions" href="core-java-interview-questions" target="_blank" rel="noopener"><span style="color: #e03e2d;"><strong>Core Java Interview Questions</strong></span></a></em></p>
</blockquote>
<p><span style="font-size: 14pt; color: #e03e2d;"><strong>Core Java Sample Resume Secrets You Need To Know:</strong></span></p>
<ul>
<li>Bold the most recent job titles you have held.</li>
<li>Invest time in underlining the most relevant skills.</li>
<li>Showcase transparency in employment Gaps (if any).</li>
<li>Make it clear in the 'objectives' that you are qualified for the type of job you are applying to.</li>
<li>Feature your communication skills and quick learning ability.</li>
<li>Highlight your roles and responsibilities.</li>
</ul>
<p>&nbsp; &nbsp;</p>17:T5685,<p>&nbsp;</p>
<p style="text-align: justify;">Welcome to Core Java&nbsp; Tutorials. The objective of these tutorials is to provide an in-depth understanding of Core Java.</p>
<p style="text-align: justify;">In addition to free Core Java&nbsp; Tutorials, we will cover common interview questions, issues, and how to&rsquo;s of Core Java.</p>
<h2 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Introduction</strong></span></h2>
<p style="text-align: justify;">The prime reason behind the creation of Java was to bring portability and security features into a computer language. Besides these two major features, there were many other features that played an important role in molding out the final form of this outstanding language.</p>
<p style="text-align: justify;">Those features are</p>
<p><span style="font-size: 14pt; color: #ba372a;"><strong>Simple</strong></span></p>
<p style="text-align: justify;">Java is easy to learn and its syntax is quite simple, clean, and easy to understand. The confusing and ambiguous concepts of C++ are either left out in Java or they have been re-implemented in a cleaner way.</p>
<p style="text-align: justify;"><em>Eg:</em> Pointers and <a class="zem_slink" title="Operator overloading" href="http://en.wikipedia.org/wiki/Operator_overloading" target="_blank" rel="noopener">Operator Overloading</a> are not there in java but were an important part of C++.</p>
<p><span style="font-size: 14pt; color: #ba372a;"><strong>Object-Oriented</strong></span></p>
<p style="text-align: justify;">In java, everything is an object which has some data and behavior. Java can be easily extended as it is based on Object Model.</p>
<p><span style="color: #ba372a; font-size: 14pt;"><strong>Robust</strong></span></p>
<p style="text-align: justify;">Java makes an effort to eliminate error-prone codes by emphasizing mainly on compile-time error checking and runtime checking. But the main areas which Java improved were Memory Management and mishandled Exceptions by introducing automatic <strong>Garbage Collector</strong> and <strong>Exception Handling</strong>.</p>
<p><strong><a class="zem_slink" title="Cross-platform" href="http://en.wikipedia.org/wiki/Cross-platform" target="_blank" rel="noopener wikipedia"><span style="font-size: 14pt; color: #ba372a;">Platform Independent</span></a></strong></p>
<p style="text-align: justify;">Unlike other programming languages such as C, C++, etc which are compiled into platform-specific machines. Java is guaranteed to be write-once, run-anywhere language.</p>
<p style="text-align: justify;">On compilation, the Java program is compiled into bytecode. This bytecode is platform-independent and can be run on any machine, plus this bytecode format also provides security. Any machine with <a class="zem_slink" title="Java virtual machine" href="http://en.wikipedia.org/wiki/Java_virtual_machine" target="_blank" rel="noopener wikipedia">Java Runtime Environment</a> can run Java Programs.</p>
<p><span style="font-size: 14pt; color: #ba372a;"><strong>Secure</strong></span></p>
<p style="text-align: justify;">When it comes to security, Java is always the first choice. With java secure features it enables us to develop a virus-free, temper free system. Java program always runs in Java runtime environment with almost null interaction with system OS, hence it is more secure.</p>
<p><strong><span style="font-size: 14pt; color: #ba372a;">Multi-Threading</span></strong></p>
<p style="text-align: justify;">Java multithreading feature makes it possible to write programs that can do many tasks simultaneously. The benefit of multi-threading is that it utilizes the same memory and other resources to execute multiple threads at the same time, like While typing, grammatical errors are checked along.</p>
<p><span style="font-size: 14pt; color: #ba372a;"><strong>Architectural Neutral</strong></span></p>
<p style="text-align: justify;">The <a href="https://en.wikipedia.org/wiki/Compiler" target="_blank" rel="noopener">compiler</a> generates bytecodes, which have nothing to do with particular computer architecture, hence a Java program is easy to interpret on any machine.</p>
<p><span style="font-size: 14pt; color: #ba372a;"><strong>Portable</strong></span></p>
<p style="text-align: justify;">Java <a class="zem_slink" title="Bytecode" href="http://en.wikipedia.org/wiki/Bytecode" target="_blank" rel="noopener wikipedia">Byte code</a> can be carried to any platform. No implementation-dependent features. Everything related to storage is predefined, for example, the size of <a class="zem_slink" title="Primitive data type" href="http://en.wikipedia.org/wiki/Primitive_data_type" target="_blank" rel="noopener wikipedia">primitive data types</a></p>
<p><span style="font-size: 14pt; color: #ba372a;"><strong>High Performance</strong></span></p>
<p style="text-align: justify;">Java is an interpreted language, so it will never be as fast as a compiled language like C or C++. But, Java enables high performance with the use of a just-in-time compiler.</p>
<h2 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Java Core Concepts</strong></span></h2>
<div id="mainBody">
<div id="pageToc">
<p style="text-align: justify;">1. Variables</p>
<p style="text-align: justify;">2. Operations</p>
<blockquote>
<p style="text-align: center;"><em>Inclined to build a profession as core java training? Then here is the blog post on, explore <a title="core java training" href="core-java-training" target="_blank" rel="noopener"><span style="color: #e03e2d;"><strong>core java training</strong></span></a></em></p>
</blockquote>
<p style="text-align: justify;">3. Classes + Objects</p>
<ul>
<li style="text-align: justify;">Fields</li>
<li style="text-align: justify;">Constructors</li>
<li style="text-align: justify;">Methods</li>
</ul>
<p style="text-align: justify;">4. Interfaces</p>
<span style="font-size: 14pt; color: #ba372a;"><strong>Variables</strong></span>
<p style="text-align: justify;"><a class="zem_slink" title="Computer program" href="http://en.wikipedia.org/wiki/Computer_program" target="_blank" rel="noopener wikipedia">Computer programs</a>, regardless of programming language, typically read data from somewhere (file, keyboard, mouse, network, etc.), process the data, and write some data somewhere again (to screen, file, network, etc.).</p>
<p style="text-align: justify;">In Java, program data is kept in <em>variables</em>. Your Java program first declares the variables, then read data into them, execute operations on the variables, and then write the variables (or data based on the variables) somewhere again. Variables are explained in more detail in the text on Java variables.</p>
<p style="text-align: justify;">Each variable has a data type. The data type determines what kind of data the variable can contain, and what operations you can execute on it. For instance, a variable could be a number. Numbers can be added, subtracted, multiplied, divided, etc. Or, a variable could be a string (text). String's can be divided into substrings, searched for characters, concatenated with other strings, etc. Java comes with a set of built-in data types. These data types are described in more detail in the text on <a href="http://tutorials.jenkov.com/java/data-types.html" target="_blank" rel="noopener">Java data types</a>.</p>
<p style="text-align: justify;">Here is a simple Java <a class="zem_slink" title="Declaration (computer programming)" href="http://en.wikipedia.org/wiki/Declaration_%28computer_programming%29" target="_blank" rel="noopener">variable declaration</a> and operation example. Don't worry if you don't understand it now. Later texts in this Java language tutorial explains the details. The purpose of the example is just to give you a feeling for how working with Java variables look.</p>
<pre class="codeBox">int myNumber;

myNumber = 0;

myNumber = myNumber + 5;</pre>
<p style="text-align: justify;">The first line of this example declares a variable named <span style="color: #ba372a;"><code>myNumber</code></span> of the data type <span style="color: #ba372a;"><code>int</code>.</span> An <span style="color: #ba372a;"><code>int</code></span> is a 32-bit integer (number without fractions).</p>
<p style="text-align: justify;">The second line sets the value of the <span style="color: #ba372a;"><code>myNumber</code></span> variable to 0.</p>
<p style="text-align: justify;">The third line adds 5 to the current value of <span style="color: #ba372a;"><code>myNumber</code></span></p>
<span style="font-size: 14pt; color: #ba372a;"><strong>Operations</strong></span>
<p style="text-align: justify;">Operations in Java are the instructions you can use to process the data in variables. Some operations read and write the values of variables (as you have already seen examples of), while other operations control the <a class="zem_slink" title="Control flow" href="http://en.wikipedia.org/wiki/Control_flow" target="_blank" rel="noopener wikipedia">program flow</a>. The most important operations are:</p>
<p style="text-align: justify;">1. Variable operations</p>
<ul>
<li style="text-align: justify;">Variable assignment of values.</li>
<li style="text-align: justify;">Variable reading of values.</li>
<li style="text-align: justify;">Variable arithmetic.</li>
<li style="text-align: justify;">Object instantiation.</li>
</ul>
<p style="text-align: justify;">2. Program flow</p>
<ul>
<li style="text-align: justify;"><span style="color: #ba372a;"><code>for</code></span> loops.</li>
<li style="text-align: justify;"><span style="color: #ba372a;"><code>while</code></span> loops.</li>
<li style="text-align: justify;"><span style="color: #ba372a;"><code>if</code></span> statements (branches).</li>
<li style="text-align: justify;"><span style="color: #ba372a;"><code>switch</code></span> statements.</li>
</ul>
<p style="text-align: justify;">3. Method calls.</p>
<p style="text-align: justify;">All of these operations are explained in detail in their own texts.</p>
<p style="text-align: justify;">Here are a few examples of operations:</p>
<pre class="codeBox">int number = 0;
int abs    = 0;
    
//imagine some operations that assign a value to number 
// - but left out of this example.
    
if(number &gt;= 0) {
    abs = number;    
} else {
    abs = -number; 
}</pre>
<p style="text-align: justify;">This example first declares two variables named <span style="color: #ba372a;"><code>number</code></span> and <span style="color: #ba372a;"><code>abs</code>.</span> The variable <span style="color: #ba372a;"><code>abs</code></span> is supposed to contain the absolute value of <span style="color: #ba372a;"><code>number</code>.</span> The absolute value of a number is always positive. For positive numbers, the absolute value is the number itself. For negative numbers, the absolute value is the number without the negative sign. For instance, the absolute value of -10 is 10.</p>
<p style="text-align: justify;">The <span style="color: #ba372a;"><code>if</code></span> operation checks the value of the <span style="color: #ba372a;"><code>number</code></span> variable to see if it is larger than or equal to 0. If it is, the absolute value assigned to the <span style="color: #ba372a;"><code>abs</code></span> variable is the value of the <span style="color: #ba372a;"><code>number</code></span> variable. If the <span style="color: #ba372a;"><code>number</code></span> value is less than 0, then the value assigned to <span style="color: #ba372a;"><code>number</code></span> is equal to <span style="color: #ba372a;"><code>-number</code>.</span> Negating a negative number gives a positive number, remember? -(-10) is 10.</p>
<span style="font-size: 14pt; color: #ba372a;"><strong>Classes + Objects</strong></span>
<p style="text-align: justify;">Classes group variables and operations together in coherent modules. A class can have fields, constructors, and methods (plus more, but that is not important now). I will shortly describe fields, constructors, and methods here, but they are explained in more detail in their own texts too.</p>
<p style="text-align: justify;">Objects are instances of classes. When you create an object, that object is of a certain class. The class is like a template (or blueprint) telling how objects of that class should look. When you create an object, you say "give me an object of this class".</p>
<p style="text-align: justify;">If you think of a factory producing lots and lots of the same items, then the class would be the blueprint/manual of how the finished product should look, and the objects would be each of the finished products. If the factory produced cars, then the blueprint/design manual of the cars to produce corresponds to a Java class, and the physical cars produced corresponds to Java objects.</p>
<p style="text-align: justify;">Here is a simple diagram illustrating the principle of objects being of a certain class. The class determines what fields and methods the objects of that class have.</p>
<p style="text-align: justify;"><img class=" wp-image-21940 aligncenter" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/06/Capture-37.png" alt="Core Java" width="479" height="243" /></p>
<p style="text-align: justify;">A Java class can contain fields, constructors, and methods</p>
<p style="text-align: justify;">public class Car {Here is an example Java class declaration: }</p>
<p style="text-align: justify;">This example declares a class named <span style="color: #ba372a;"><code>Car</code>.</span> The Car class does not contain any fields, constructors, or methods. It is empty. The example primarily serves to show you an example of how a class declaration looks in Java code.</p>
<h2 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Fields</strong></span></h2>
<p style="text-align: justify;">A field is a variable that belongs to a class or an object. It is a piece of data, in other words. For instance, a Car class could define the field <span style="color: #ba372a;"><code>brand</code></span> which all Car objects would have. Each Car object could then have a different value for the brand field.</p>
<p style="text-align: justify;">Fields are covered in more detail in the text on Java fields.</p>
<p style="text-align: justify;">Here is the Car class declaration from above with a field name <span style="color: #ba372a;"><code>brand</code></span> added:</p>
<pre class="codeBox">public class Car {
    private String brand;
}
</pre>
<p style="text-align: justify;">This example declares a field named <span style="color: #ba372a;"><code>brand</code></span> of data type <span style="color: #ba372a;"><code>String</code></span> which is text.</p>
<h2 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Constructors</strong></span></h2>
<p style="text-align: justify;">Constructors are a special kind of method that is executed when an object of that class is created. Constructors typically initialize the object's internal fields - if necessary.</p>
<p style="text-align: justify;">Constructors are covered in more detail in the text on Java constructors.</p>
<p style="text-align: justify;">Here is the Car class from before with a constructor that initializes the <span style="color: #ba372a;"><code>brand</code></span> field:</p>
<pre class="codeBox">public class Car {
    
    private String brand;

    public Car(String theBrand) {
        this.brand = theBrand;
    }
}</pre>
<h2 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Methods</strong></span></h2>
<p style="text-align: justify;">Methods are groups of operations that carry out a certain function together. For instance, a method may add to numbers, and divide it by a third number. Or, a method could read and write data in a database, etc.</p>
<p style="text-align: justify;">Methods are typically used when you need to group operations together, that you need to be able to execute from several different places. Or, if you just want your code to be easier to read. In other programming languages, methods may be called "procedures" or "functions".</p>
<p style="text-align: justify;">Methods are covered in more detail in the text on Java methods.</p>
<p style="text-align: justify;">Here is the Car class from before with a single, simple method named <span style="color: #ba372a;"><code>getBrand</code></span> added:</p>
<pre class="codeBox">public class Car {
    
    private String brand;

    public Car(String theBrand) {
        this.brand = theBrand;
    }
    
    
    public String getBrand() {
        return this.brand;
    }
}</pre>
<span style="font-size: 14pt; color: #ba372a;"><strong>Interfaces</strong></span>
<p style="text-align: justify;">The interface is a central concept in Java. An interface describes what methods a certain object should have available on it. A class can implement an interface. When a class implements an interface, the class has to implement all the methods described in the interface. Interfaces are described more in my text about Java interfaces.</p>
<span style="font-size: 14pt; color: #ba372a;"><strong>Packages</strong></span>
<p style="text-align: justify;">Packages in Java is another central concept. A package is a directory containing Java classes and interfaces. Packages provide a handy way of grouping related classes and interfaces, thus making modularization of your Java code easier. Packages are described in more detail in my text about Java pack</p>
<h2 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Data Types in Java</strong></span></h2>
<p style="text-align: justify;">Java language has a rich implementation of data types. Data types specify size and the type of values that can be stored in an identifier.</p>
<p style="text-align: justify;">In java, data types are classified into two categories :</p>
<ol>
<li style="text-align: justify;">Primitive Data type</li>
<li style="text-align: justify;">Non-Primitive Data type</li>
</ol>
<h3 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Primitive Data type</strong></span></h3>
<p style="text-align: justify;">A primitive data type can be of eight types:</p>
<ul>
<li style="text-align: justify;">char</li>
<li style="text-align: justify;">boolean</li>
<li style="text-align: justify;">byte</li>
<li style="text-align: justify;">short</li>
<li style="text-align: justify;">int</li>
<li style="text-align: justify;">long</li>
<li style="text-align: justify;">float</li>
<li style="text-align: justify;">double</li>
</ul>
<p style="text-align: justify;">Once a primitive data type has been declared its type can never change, although in most cases its value can change. These eight primitive types can be put into four groups.</p>
<p style="text-align: justify;"><strong><span style="color: #ba372a;">Integer:</span>&nbsp;</strong>This group includes <span style="color: #ba372a;"><code>byte</code>, <code>short</code>,</span>&nbsp;<span style="color: #ba372a;"><code>int</code>, <code>long</code></span></p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>byte:</strong></span> It is an 8-bit integer data type. Value range from -128 to 127. Default value zero. example: <span style="color: #ba372a;"><code>byte b=10;</code></span></p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>short:</strong></span> It is a 16-bit integer data type. Value range from -32768 to 32767. Default value zero. example:<span style="color: #ba372a;"><code>short s=11;</code></span></p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>int:</strong></span> It is a 32-bit integer data type. Value range from -2147483648 to 2147483647. Default value zero. example:<span style="color: #ba372a;"><code>int i=10;</code></span></p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>long:</strong></span> It is a 64-bit integer data type. Value range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Default value zero. example: <span style="color: #ba372a;"><code>long l=100012;</code></span></p>
<h3 style="text-align: justify;"><span style="font-size: 14pt; color: #ba372a;"><strong>Floating-Point Number</strong></span></h3>
<p style="text-align: justify;">This group includes float, double</p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>float:</strong></span> It is a 32-bit float data type. Default value 0.0f. example: float ff=10.3f</p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>double:</strong></span> It is a 64-bit float data type. Default value 0.0d. example: double db=11.123</p>
<p style="text-align: justify;"><span style="color: #ba372a; font-size: 14pt;"><strong>Characters: </strong></span>This group represents char, which represent symbols in a character set, like letters and numbers.</p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>char:</strong></span> It is a 16-bit unsigned Unicode character. Range 0 to 65,535. example: char c='a';</p>
<p style="text-align: justify;"><span style="color: #ba372a;"><strong>Boolean: </strong></span>This group represents boolean, which is a special type for representing true/false values. They have defined as constants of the language. example: boolean b=true;</p>
<span style="font-size: 14pt; color: #ba372a;"><strong>Non-Primitive(Reference) Data type</strong></span>
<p style="text-align: justify;">A reference data type is used to refer to an object. A reference variable is declared to be specific and that type can never change. We will talk a lot more about reference data type later in the Classes and Object lessons.</p>
</div>
</div>
<p style="text-align: justify;"><span style="color: #000000;"><strong>For an Indepth knowledge on core java, click on below</strong></span></p>
<ul>
<li><a href="https://tekslate.com/core-java-interview-questions" target="_blank" rel="noopener">core java Interview Questions</a></li>
</ul>18:Tfef1,<p>&nbsp;</p>
<p dir="ltr"><span style="font-size: 12pt;">An MVC(model view controller) web framework which eases the construct of UI(User Interface) for server-based applications by utilizing reusable components of UI within a page. JSF allows connecting with the event handlers on the server-side and to the data sources of UI widgets. JSF gives an API(Application Programming Interface) and also presents a set of conventional UI components for building more components. JSF facilitates the extension of current conventional UI components and also permits reuse.</span></p>
<p dir="ltr"><span style="font-size: 12pt;">JSF gives the components like command button, input text and so on. JSF serves to maintain their states. JSF also facilitates data conversion, server-side validation, extensibility, describes page navigation, accessibility and internationalization.</span></p>
<p dir="ltr"><span style="font-size: 12pt;">Tag libraries of JSF utilized to connect the components with the server objects and also add the components upon the webpages, JSF has the tag handler which executes the component tag.</span></p>
<p dir="ltr"><span style="font-size: 12pt;">Simply JSF is just like AWT and Swing, JSF is also a development framework that gives a group of reusable and standard GUI components.</span></p>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">Advantages of using JSF</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">Using JSF decreases the energy of developers while designing and managing the applications, these applications operate on Java server also administer the application UI upon to the destination client.</span></p>
<ul>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF Gives reusable UI components.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Data transfer among UI components becomes easy.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Custom components implementation is enabled.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF Wires the client-side request to the server-side.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF Clear separation of presentation and behaviour.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF Gives standard and multiple merchant implementations.&nbsp;</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF is a fine-tuned event model which lets applications to be&nbsp;</span></li>
</ul>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">JSF version history</span></h3>
<div dir="ltr" style="margin-left: 0pt;" align="left">
<table style="border: none; border-collapse: collapse;"><colgroup><col width="94" /><col width="112" /><col width="395" /></colgroup>
<tbody>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;">&nbsp;</p>
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt;"><strong>Version</strong></span></p>
</td>
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr"><span style="font-size: 12pt;"><strong>Release Date</strong></span></p>
</td>
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr"><span style="font-size: 12pt;"><strong>Description</strong></span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 1.0</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">11-03-2004</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This is an initial release.&nbsp;&nbsp;</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 1.1</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">27-05-2004</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">There are no specific changes in this release; it is just a bug-fix release.</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 1.2</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">11-05-2006</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It has several enhancements over core systems and APIs. Matches with Java ee 5. original selection within java ee.</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 2.0</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">01-07-2009</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 2.0 is a huge release for ease of utilization, enhanced performance and functionality this version matches with JAVA ee6.</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 2.1</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">22-11-2010</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It implied a maintenance announcement 2 of JSF 2.0. simply a pretty lesser amount of stipulation modifications.</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF 2.2</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">21-05-2013</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">It has launched modern theories like page flow, stateless views and the capability to generate portable support arrangements.</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">JSF LifeCycle:</span></h3>
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #0e101a; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">JSF contains SIX phases in the life cycle of JSF.&nbsp;</span></p>
<ol>
<li><span style="font-size: 12pt;"><strong>Restore view</strong> this is the initial phase of the JSF life cycle, JSF begins this restore view phase as soon as the button snap. In this phase, JSF builds validators ti UI components, JSF builds the view and wires the event handlers and stores the view within the FaceContext instance. This FaceContext instance will now have all the data that is needed to develop a request.</span></li>
<li><span style="font-size: 12pt;"><strong>Apply request value</strong> this is the second phase in the JSF lifecycle after the component restored every component within the component tree utilizes the decode method to extract its brand new value from the request parameters.</span></li>
<li><span style="font-size: 12pt;"><strong>Process Validation</strong> in the phase JSF will process all the registered validators of the component tree. It explores the component attribute protocols and also minimizes these protocols to the local value saved within the component<strong>.</strong></span></li>
<li><span style="font-size: 12pt;"><strong>Update model values</strong> after inspecting the data JSF moves to the moves to the component tree and to the components&rsquo; local values it fixes the identical server-side object properties. Then to the input component value attributes the JSF will update the bean properties.</span></li>
<li><span style="font-size: 12pt;"><strong>Invoke application</strong> in this phase JSF handhold any application-level activities such as submitting a form to another page and also linking to another page</span></li>
<li><span style="font-size: 12pt;"><strong>Render response</strong> this is the last phase of the JSF life cycle. In this phase, JSF asks the application server to interpret the page if the application is utilizing the JSP pages. These components depicted on the page will be combined with the component tree while JSP container executes that page. If that is not an introductory request, then the component tree will be present, so there is no need to add the components again.&nbsp;</span></li>
</ol>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">JSF basic tags:</span></h3>
<div dir="ltr" style="margin-left: 0pt;" align="left">
<table style="border: none; border-collapse: collapse;"><colgroup><col width="293" /><col width="307" /></colgroup>
<tbody>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;"><span style="font-size: 12pt;"><strong>Tag</strong></span></td>
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt;"><strong>Description</strong></span></p>
</td>
</tr>
<tr style="height: 25.5pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:InputText</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">HTML input_ type=&rdquo;text&rdquo;, textbox.</span></p>
</td>
</tr>
<tr style="height: 48pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> h:InputSecret</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">HTML input_type=&rdquo;password&rdquo;, textbox.</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:InputTextarea</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt;"><span style="font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"> </span><span style="font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">this is the field of HTML Textarea</span></span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:InputHidden</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">HTML input_type=&rdquo;hidden&rdquo;</span></p>
</td>
</tr>
<tr style="height: 46.5pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:selectBooleanCheckbox&nbsp;</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">a individual HTML check box will be rendered</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">selectManyCheckbox</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A set of HTML checkboxes will be rendered</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:selectOneRadio</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">An individual radio button will be rendered&nbsp;</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:selectOneListbox</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">An individual Listbox will be rendered&nbsp;</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:selectManyListbox</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">Various Listboxes will be rendered</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:selectOneMenu</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">An individual combo box will be rendered</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:outputText</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A text of HTML will be rendered</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:outputFormat</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">This accepts parameters and also a text of HTML will be rendered</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:graphicImage</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">An image will be rendered by using this tag</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:outputStylesheet</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">By using this tag we will be including a CSS style sheet within the HTML output</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">h:outputScript</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">A script is added within the HTML output by using this tag</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">JSF Converter tags:</span></h3>
<div dir="ltr" style="margin-left: 0pt;" align="left">
<table style="border: none; border-collapse: collapse; width: 451.27559055118115pt; table-layout: fixed;"><colgroup><col /><col /></colgroup>
<tbody>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr"><span style="font-size: 12pt;"><strong>Tag</strong></span></p>
</td>
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr"><span style="font-size: 12pt;"><strong>Description</strong></span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f:convertnumber</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">By using this tag we can convert the string into the number of the required format</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f:convertDateandTime</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">By using this tag we can convert the string into the desired date format</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">JSF validator tags:</span></h3>
<div dir="ltr" style="margin-left: 0pt;" align="left">
<table style="border: none; border-collapse: collapse; width: 451.27559055118115pt; table-layout: fixed;"><colgroup><col /><col /></colgroup>
<tbody>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr"><span style="font-size: 12pt;"><strong>Tag </strong></span></p>
</td>
<td style="vertical-align: top; padding: 5pt; overflow: hidden; overflow-wrap: break-word; text-align: center; border: 1pt solid #000000;">
<p dir="ltr"><span style="font-size: 12pt;"><strong>Description</strong></span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f:validateLength</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We can validate the length of the string by using this tag</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f:validateLongRange</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">By using this tag we can validate the rage of a numeric value</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f:validateDoubleRage&nbsp;</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">By using this tag we can validate the range of float value</span></p>
</td>
</tr>
<tr style="height: 0pt;">
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: bold; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">f:validateRegex</span></p>
</td>
<td style="vertical-align: top; padding: 5pt 5pt 5pt 5pt; overflow: hidden; overflow-wrap: break-word; border: solid #000000 1pt;">
<p dir="ltr" style="line-height: 1.2; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt; font-family: Times, serif; color: #000000; background-color: transparent; font-weight: 400; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;">We can validate the regular expression of a JSF component</span></p>
</td>
</tr>
</tbody>
</table>
</div>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">JSF MVC Design:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">MVC is abbreviated as Model View Controller design gives a set of scheme patterns that assists you to divide the areas of interest that are involved in constructing and executing GUI applications&nbsp;</span></p>
<ul>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The model encapsulates(hides) the endurance code and enterprise logic for the application this design should be the same as the view technology.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The view must have the presentation logic and also showcases the model objects, and this view should neither show the enterprise logic nor any controller logic.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The controller is a mediator among the model and the view; the controller first communicates with the model and then passes this model objects to the view which displays them.&nbsp;</span></li>
</ul>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">MVC Implementation:</span></h3>
<p dir="ltr" role="presentation"><span style="font-size: 12pt;">In JSF MVC implementation within backing, beans act as a mediator among the view and the model. Because of this, it is necessary to restrict the persistence logic and business logic within the backing beans. One similar option is to empower business logic to a facade that serves essentially as the model.&nbsp;&nbsp;</span></p>
<p dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF view implementation is not like JSF technology; JSF view implementation is a component model of statefulness. The JSF view constituted of two sections. They are the JSP pages and view root.</span></p>
<ol>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The JSP page fixes UI components over JSP pages and permits us to unite field components to qualities of backing beans.&nbsp;&nbsp;</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The view root is a combination of UI state and UI components that manage the UI state.&nbsp;</span></li>
</ol>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">Request processing Lifecycle of JSF:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">There are six phases in the request processing life cycle of JSF.</span></p>
<ol>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Restore component model: The controller checks the request and concretes the view ID which is detected by JSP page name if the view is not already present then the JSF controller build it, it the view is already present then the JSF controller utilizes it the view will have all the components.&nbsp;</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Apply request values: each component utilizes the apply request value phase to regain the components contemporary(current) state the values of components are regained from request parameters.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Process validation: in this phase, every component holds its values verified against the application validation protocols.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Update model: this phase, the server-side model values are updated; this can happen only by updating the backing beans properties.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Invoke Application: The controller of JSF invokes the application to manage Form resignations. The component values will be switched, validated, and implemented over the model objects. Therefore we can instantly utilize them to administer the business logic of the application.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Render response: this shows the view and all the components of view and their current state, and later execute the page furthermore transfer it back to the customer.</span></li>
</ol>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">Standard UI components of JSF:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">There are 12 JSF UI components.</span></p>
<ul>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIInput</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UISelectBoolean</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIOutput</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UISelectMany</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UISelectItem</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UISelectOne</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UICommand</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIGraphic</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIPanel</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIData</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIColumn</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">UIForm</span></li>
</ul>
<h3 dir="ltr"><span style="font-size: 12pt; color: #e67e23;">Characteristics of JSF:&nbsp;</span></h3>
<ul>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF is a framework which depends on the components.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF combines with the language called expression language.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The JSF implements Facelet technology.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF upholds HTML5.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Internationalization is supported by JSF.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF makes web development easy.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">By using JSF, we can Rapidly develop web pages.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Bean Annotations</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Templating is the important feature of JSF</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Exception handling is the default in the JSF</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">JSF has a better security</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">AJAX support is Inbuilt</span></li>
</ul>
<h3 dir="ltr"><span style="font-size: 12pt;">Navigation Rules:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">Navigation rules are the protocols that are given by the JSF framework that defines which view should be displayed whenever a link or a button clicked. These protocols can be described within the configuration file of JSF, which is named as faces-config.xml. These can be described within the managed beans. Navigation rules will have the conditions which are based on the resulted view.</span></p>
<h3 dir="ltr"><span style="font-size: 12pt;">Internationalization:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">Internationalization is a technique within which currency, status messages, date and GUI component labels are not impended within the program rather they are saved outside the source code that is present within resource bundles, and they are retrieved dynamically.</span></p>
<p dir="ltr"><span style="font-size: 12pt;">There are three steps to internalize the JSF application.</span></p>
<ol>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Property files are defined.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Faces-config.xml is updated</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Resource-bundle var is utilized.&nbsp;&nbsp;&nbsp;</span></li>
</ol>
<h3 dir="ltr"><span style="font-size: 12pt;">Method and value Binding:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">Within JSF, we can obtain some values like a managed bean through value binding. As value binding, the universal(EL) Expression Language is practised to obtain bean or/and methods, Meanwhile, in JSF we do not require to define the set() or get() methods but simply the mane of a variable. Method binding can be utilized to wrap a JSF component, for example, a link over a method of the Java class.</span></p>
<p dir="ltr"><span style="font-size: 12pt; color: #e67e23;"><strong>Prerequisites to utilize JSF:</strong></span></p>
<p dir="ltr"><span style="font-size: 12pt;">To utilize JSF, we just need&nbsp;</span></p>
<ul>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Implementation of JSF.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">Tag libraries of the JSTL.&nbsp;</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">The runtime environment of JAVA.</span></li>
<li dir="ltr" role="presentation"><span style="font-size: 12pt;">And finally, a Web container in which we can use JSF.</span></li>
</ul>
<h3 dir="ltr"><span style="font-size: 12pt;">Why JSF is not so popular:</span></h3>
<p dir="ltr"><span style="font-size: 12pt;">There are a lot of implementations of JSF like richfaces and primefaces which makes JSF difficult to the client to learn, comprehend and adapt to where the Spring MVC possesses hardly one implementation supported by a particular assortment of developers which eludes trouble.&nbsp;</span></p>
<p dir="ltr"><span style="font-size: 12pt;">Spring has prepared comprehensive combination including data management within ORM frameworks or standalone outside the case which is requiring in JSF implementation.</span></p>
<p>&nbsp;</p>
<p dir="ltr" style="line-height: 1.38; margin-top: 0pt; margin-bottom: 0pt;"><span style="font-size: 12pt;">JSF is a component-based framework where a Spring is a client-server based framework. Therefore, it is simple to learn and correlates intimately to Struts2, MVC and few another comparable framework.</span></p>
<h3 style="box-sizing: border-box; margin-top: 0px; margin-bottom: 0.5rem; font-family: quicksand, sans-serif; line-height: 1.2; color: #333333; font-size: 36px; background-color: #ffffff;"><span style="font-size: 14pt; color: #e67e23;">Index</span></h3>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="introduction-jsf/">Introduction to JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="developing-registration-application-jsf/">Developing Registration Application in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="difference-bet-n-jsf1-x-jsf-2-x/">DIFFERENCE BET N JSF1.X &amp;JSF 2.X</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="steps-design-jsf-1-2-application-eclipse-ide/">STEPS TO DESIGN JSF 1.2 APPLICATION IN ECLIPSE IDE</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="steps-design-first-application-jsf/">STEPS TO DESIGN FIRST APPLICATION in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="mvc-rules-regulation-jsf/">MVC Rules and Regulation in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="creation-working-first-servlet-jsf/">Creation and working with First Servlet in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="frameworks-jsf/">FrameWorks in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="enterprise-application-jsf/">Enterprise Application in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="steps-use-hyperlinks-jsf-pages/">Steps to use Hyperlinks in JSF pages</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="introduction-i18n-applications-jsf/">Introduction to I18N Applications in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="developing-i18n-applications-jsf/">Developing I18N Applications in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="steps-provide-i18n-support-jsf-application/">steps to provide I18N Support in JSF Application</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="validations-jsf/">VALIDATIONS in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="jsf2-validations-application/">JSF2 Validations Application</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="developing-jsf2-validations-application/">Developing JSF2 Validations Application</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="converters-jsf/">CONVERTERS IN JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="basic-gui-components-jsf/">Basic GUI Components in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="layouts-jsf-tiles/">Layouts in JSF- Tiles</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="event-handler-event-handling-jsf/">Event Handler Event handling in JSF</a></li>
</ul>
</ul>
<ul style="box-sizing: border-box; margin: 0px; list-style: outside none none; padding: 0px; color: #333333; font-family: quicksand, sans-serif; font-size: 14px; background-color: #ffffff;">
<li style="box-sizing: border-box; list-style: disc; margin: 5px 0px 5px 25px; line-height: 25px;"><a style="box-sizing: border-box; color: #007bff; text-decoration-line: none; background-color: transparent; transition: all 0.2s linear 0s;" href="jsf-elements/">JSF Elements</a></li>
</ul>19:T66f0,<p>&nbsp;</p>
<h2 style="text-align: justify;"><span style="color: #000000; font-size: 14pt;">Data Structures Interview Questions And Answers</span></h2>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;">Q1. What is the data structure?</span></h3>
<p style="text-align: justify;"><span style="font-size: 12pt;"><strong>Ans: </strong>A data structure is the logical or mathematical arrangement of data in memory. It considers not only the physical layout of the data items in the memory but also the relationships between these data items and the operations that can be performed on these items.</span></p>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;">Q2. Define a variable ?</span></h3>
<p style="text-align: justify;"><span style="font-size: 12pt;"><strong>Ans: </strong>A variable is defined as a meaningful name given to a data storage location in the computer memory. When using a variable, we actually refer to the address of the memory where the data is stored.</span></p>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;">Q3. Which Data Structure Should be used for implementing LRU cache?</span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans:&nbsp;</strong></span></p>
<ul style="text-align: justify;">
<li><span style="font-size: 12pt;">The queue is implemented using a doubly-linked list. The maximum size of the queue will be equal to the total number of frames available (cache size). The most recently used pages will be near front end and least recently pages will be near the rear end.</span></li>
<li><span style="font-size: 12pt;">A Hash&nbsp;with page number as key and address of the corresponding queue node as value.</span></li>
</ul>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;">Q4. How to implement a stack using a queue?</span></h3>
<p style="text-align: justify;"><span style="font-size: 12pt;"><strong>Ans: </strong>A stack can be implemented using two queues. Let stack to be implemented be &lsquo;s&rsquo; and queues used to implement be &lsquo;q1&rsquo; and &lsquo;q2&rsquo;. Stack &lsquo;s&rsquo; can be implemented in two ways:</span></p>
<ul style="text-align: justify;">
<li><span style="font-size: 12pt;">Method 1 (By making push operation costly)</span></li>
<li><span style="font-size: 12pt;">Method 2 (By making pop operation costly)</span></li>
</ul>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;"><strong>Q5. How is an Array different from Linked List?</strong></span></h3>
<p style="text-align: justify;"><span style="font-size: 12pt;"><strong>Ans: </strong></span></p>
<ul>
<li style="text-align: justify;"><span style="font-size: 12pt;">The size of the arrays is fixed, Linked Lists are Dynamic in size.</span></li>
<li style="text-align: justify;"><span style="font-size: 12pt;">Inserting and deleting a new element in an array of elements is expensive, Whereas both insertion and deletion can easily be done in Linked Lists.</span></li>
<li style="text-align: justify;"><span style="font-size: 12pt;">Random access is not allowed in Linked Listed.</span></li>
<li style="text-align: justify;"><span style="font-size: 12pt;">Extra memory space for a pointer is required with each element of the Linked list.</span></li>
<li style="text-align: justify;"><span style="font-size: 12pt;">Arrays have better cache locality that can make a pretty big difference in performance.</span></li>
</ul>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;">Q6. What are linear and non-linear data structures?</span></h3>
<p style="text-align: justify;"><span style="font-size: 12pt;"><strong>Ans: </strong>A linear data structure involves the arrangement of values in a linearly. Some typical examples of a linear data structure are lists, queues, stacks, and arrays.</span></p>
<p style="text-align: justify;"><span style="font-size: 12pt;">In a non-linear data structure, the elements are not stored in a sequence. Graphs and tree are some examples of a non-linear data structure.</span></p>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;"><strong>Q7. What is the difference between a data type and data structure?</strong></span></h3>
<p style="text-align: justify;"><span style="font-size: 12pt;"><strong>Ans: </strong>In computing, a data type is a group of data values with characteristics that are already defined. Some data types are floats, characters, integer, and string. These are called primitive data types. A data structure, on the other hand, is a grouping of data for easy organization and accessibility. Tables, Array stacks, structs, queues, classes, files, and lists are some data structure.</span></p>
<h3 style="text-align: justify;"><span style="font-size: 12pt; color: #e67e23;"><strong>Q8. What are data structure operations?</strong></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans:&nbsp;</strong></span></p>
<ul style="text-align: justify;">
<li><span style="font-size: 12pt;">Traversing</span></li>
<li><span style="font-size: 12pt;">Insertion</span></li>
<li><span style="font-size: 12pt;">Searching</span></li>
<li><span style="font-size: 12pt;">Deletion</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q9. </span><span style="font-size: 12pt;">Can you list out all the operations that can be performed/executed in data structures?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The following are the operations that can be executed in data structures:</span></p>
<ul>
<li><span style="font-size: 12pt;">Insertion: Insertion is a process where a new data element can be added to the data items collection.&nbsp;</span></li>
<li><span style="font-size: 12pt;">Deletion: Deletion is a process where a data element can be deleted from the data items collection.&nbsp;</span></li>
<li><span style="font-size: 12pt;">Traversal: Traversal id one of the basic operations within the data structure. Also, in this process, every data element can be accessed.</span></li>
<li><span style="font-size: 12pt;">Searching: Searching is a process where a data element can be searched within the collection of data elements. The data element should be present in the data collection.&nbsp;</span></li>
<li><span style="font-size: 12pt;">Sorting: Sorting is a process where the data elements can be arranged in an orderly fashion, i.e. ascending or descending order.&nbsp;</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q10. </span><span style="font-size: 12pt;">Explain what is a Stack and it's usage?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The Stack is nothing but a linear data structure where the data elements can be accessed. They are two ways to access the data elements,&nbsp;</span></p>
<ul>
<li><span style="font-size: 12pt;">First in Last out (FILO)</span></li>
<li><span style="font-size: 12pt;">Last in First out (LIFO)</span></li>
</ul>
<p><span style="font-size: 12pt;">For Stack, the basic operations are listed below:</span></p>
<ul>
<li><span style="font-size: 12pt;">Push</span></li>
<li><span style="font-size: 12pt;">Pop</span></li>
<li><span style="font-size: 12pt;">Peek</span></li>
</ul>
<h3><span style="font-size: 12pt; color: #e67e23;">Q11. What is a queue and how it is implemented?</span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A queue is also a linear form of data structure where all the data elements are available in a systematic format. The data elements are available in First in First out form (FIFO).</span></p>
<p><span style="font-size: 12pt;">The basic operation of the Queue are listed below:</span></p>
<ul>
<li><span style="font-size: 12pt;">Enqueue</span></li>
<li><span style="font-size: 12pt;">Dequeue</span></li>
<li><span style="font-size: 12pt;">Front</span></li>
<li><span style="font-size: 12pt;">Rear</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q12. </span><span style="font-size: 12pt;">What is the difference between Queue and Stack?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>Both Queue and Stack are the same and follow a linear data structure model. The main difference between these two is the way a record is deleted/removed.</span></p>
<p><span style="font-size: 12pt;">In a stack, the most recent data element that is added will be removed. Whereas, in Queue, the least recent data element that is added to the list will be deleted.&nbsp;</span></p>
<p><span style="font-size: 12pt;">Queues and Stacks are created with the use of arrays and linked lists.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q13. </span><span style="font-size: 12pt;">List out the different types of Linked lists that are available?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>Below is the different types of Linked lists that are available.&nbsp;</span></p>
<ul>
<li><span style="font-size: 12pt;">Singly Linked List</span></li>
<li><span style="font-size: 12pt;">Doubly Linked list</span></li>
<li><span style="font-size: 12pt;">Circular Linked list</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q14. </span><span style="font-size: 12pt;">Explain the difference between file structure and storage structure?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The key difference between a storage structure and the file structure is the amount of memory that has been acquired.</span></p>
<p><span style="font-size: 12pt;">The data structure that is stored in the main memory of the computer system is classified as a storage structure. This is an inbuilt storage system where the data is available.&nbsp;</span></p>
<p><span style="font-size: 12pt;">On the other hand, if the data is residing on an extra/backup storage then it is classified as a File structure.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q15. </span><span style="font-size: 12pt;">Explain what is a stack?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A Stack can be classified as an ordered list where all the operations like insertions/ deletions can be executed only from one end. The mentioned stack is nothing but a pure list of execution tasks, the order follows LIFO structure, i.e. Last-In-First-Out. So according to the LIFO structure, the line item that is entered into the stack will be executed at the end (concerning the priority).</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q16. </span><span style="font-size: 12pt;">Can you list out the operations that can be performed on Stack?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The following are the list of operations that can be performed on Stack.</span></p>
<ul>
<li><span style="font-size: 12pt;">Push operation:</span></li>
<li><span style="font-size: 12pt;">Peek operation</span></li>
<li><span style="font-size: 12pt;">Pop operation</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q17. </span><span style="font-size: 12pt;">Do you know the syntax of stack overflow condition?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The syntax of stack overflow condition is :</span></p>
<p><span style="font-size: 12pt;">when top=maxsize-1</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q18. </span><span style="font-size: 12pt;">Explain the difference between push and pop operations?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>With the help of push and pop operations, the data can be effectively handled/managed within a stack. The main difference between push and pop operations is listed below:</span></p>
<p><span style="font-size: 12pt;">Push operation:</span></p>
<p><span style="font-size: 12pt;">Push operation is used when inserting the data into the Stack.</span></p>
<p><span style="font-size: 12pt;">Pop Operation:</span></p>
<p><span style="font-size: 12pt;">Pop operation is used when deleting the data from the Stack.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q19. </span><span style="font-size: 12pt;">Describe what is an array?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>An array is nothing but a collection of data elements that are stored together in a memory location. Also, accessing the data elements within an array is very simple and every data element will have their index number. Using the index number the data element can be easily accessed.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q20. </span><span style="font-size: 12pt;">Explain what do you mean by a multi-dimensional array?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A multi-dimensional array is nothing but an array of arrays. The data is stored or piled in the form of the tabular structure where it has rows and columns. The use of multi-dimensional arrays will help to store more amount of data in chunks.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q21. A</span><span style="font-size: 12pt;">&nbsp;node contains two fields, can you tell me what are they?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A node contains two fields, they are :</span></p>
<ul>
<li><span style="font-size: 12pt;">Data field</span></li>
<li><span style="font-size: 12pt;">Link field</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q22. </span><span style="font-size: 12pt;">Explain what do you mean by the queue data structure?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A queue data structure is nothing but an ordered list that is piled up in the form of a stack. They are two ends to the queues where the operations can be taken into consideration:</span></p>
<p><span style="font-size: 12pt;">Rear: All the data insertions are performed in Rear.</span></p>
<p><span style="font-size: 12pt;">Front: All the data deletions are performed in Front.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q23. </span><span style="font-size: 12pt;">Can you list out some practical examples of the queue data structure?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>Below is the few practical examples of data structure:</span></p>
<p><span style="font-size: 12pt;">The daily usage of printers. All the print jobs at the printer follow a queue data structure. The same with all of your computing requests, CPU handles it well by a queuing mechanism</span></p>
<p><span style="font-size: 12pt;">&nbsp;Data transfer activities via, sockets, pipes follow a queue data structure.</span></p>
<p><span style="font-size: 12pt;">&nbsp;All the media songs that are piled up one after the other, i.e. playlists.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q24. </span><span style="font-size: 12pt;">What is a dequeue?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>Dequeue is also known as a double-ended queue. It is exactly the opposite of a queue mechanism. In dequeue structure, all the data insertions and data deletion activities can be executed from both the sides, i.e. Front &amp; Rear.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q25. </span><span style="font-size: 12pt;">Can you let me know the minimum number of queues that are needed to implement a priority queue?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>In general, to implement the priority queue, we need a bare minimum of at least two queues. One queue is essential to store all of the data elements together and another queue is needed to store the priority-based information.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q26. </span><span style="font-size: 12pt;">Do you know how many types of trees are available? List them out?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>They are 6 types of tree that are available. Below is the list:</span></p>
<ul>
<li><span style="font-size: 12pt;">Binary search tree</span></li>
<li><span style="font-size: 12pt;">General tree</span></li>
<li><span style="font-size: 12pt;">Tournament tree</span></li>
<li><span style="font-size: 12pt;">&nbsp;Binary tree</span></li>
<li><span style="font-size: 12pt;">&nbsp;Forests</span></li>
<li><span style="font-size: 12pt;">&nbsp;Expression tree</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q27. </span><span style="font-size: 12pt;">Explain what is Binary tree?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A binary tree is a type of tree structure where each node has two children, i.e left child, and right child. Using this the tree structure can be progressed.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q28. </span><span style="font-size: 12pt;">Can you please let me know which data structure is best for tree construction?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A queue data structure is the best data structure fit for tree construction.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q29. </span><span style="font-size: 12pt;">Explain what is a Path?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A path is an orderly sequence of a continuous flow of vertices which are connected via their edges. Usually in this type of sequence, there are no restrictions observed.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q30. </span><span style="font-size: 12pt;">Explain what is the cycle?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A cycle is nothing but a closed path where the first vertice is the same as to that of the last/end vertex. Also, we get to see one condition here, the same vertex should not be passed twice.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q31. </span><span style="font-size: 12pt;">Explain what is a circuit?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A circuit is very similar to that of a cycle but the only difference is that the vertex can be passed n number of times and don't have any restrictions. Within the circuit, the first vertex is the same as that of the last vertex.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q32. </span><span style="font-size: 12pt;">For the BFS algorithm which data structure is useful?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>For the BFS algorithm, the queue data structure is useful.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q33. </span><span style="font-size: 12pt;">For the DFS algorithm, which data structure is useful?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>For the DFS algorithm, the stack data structure is useful.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q34. </span><span style="font-size: 12pt;">What is a linear search?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>Linear search is also known as a sequential search. With this linear search approach, the search element is compared to every element in the list sequentially until a potential match is found.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q35. </span><span style="font-size: 12pt;">What is a binary search?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A binary search is also called a half interval search or a binary chop. Within this search algorithm, the target value will be identified by comparing it to the array.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q36. </span><span style="font-size: 12pt;">Can you list out the advantages of selection sort?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The advantages of selection sort are given below:</span></p>
<ul>
<li><span style="font-size: 12pt;">It is easy to use</span></li>
<li><span style="font-size: 12pt;">Implementation wise it doesn't take much time</span></li>
<li><span style="font-size: 12pt;">Selection sort can be applied for smaller data sets</span></li>
<li><span style="font-size: 12pt;">&nbsp;it is efficient when compared to bubble sort</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q37. </span><span style="font-size: 12pt;">Explain what is NULL?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A NULL is a value that can be assigned to a data element. It represents that there is no data available for that particular data element.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q38. </span><span style="font-size: 12pt;">Explain what is VOID?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>VOID is a data type identifier.&nbsp;</span></p>
<p><span style="font-size: 12pt;">It is used to identify pointers that don't have a size associated.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q39. </span><span style="font-size: 12pt;">Explain the main difference between a binary search and linear search?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The main difference between a binary search and the linear search is the number of comparisons it does to the target value. In most of the cases, binary search is quick compared to the linear search.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q40. </span><span style="font-size: 12pt;">For sequential representation, which data structure is used?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>An adjacency matrix is a data structure that is used for sequential representation.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q41. </span><span style="font-size: 12pt;">For linked representation, which data structure is used?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>An adjacency list is used for linked representation.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q42. </span><span style="font-size: 12pt;">Can you let me know where the tree data structure is applied?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The tree data structure is applied in the following area:</span></p>
<ul>
<li><span style="font-size: 12pt;">To understand the hierarchal data model</span></li>
<li><span style="font-size: 12pt;">Analysis of the syntax</span></li>
<li><span style="font-size: 12pt;">Symbol table construction process</span></li>
<li><span style="font-size: 12pt;">Arithmetic expressions and its manipulation.&nbsp;</span></li>
</ul>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q43. </span><span style="font-size: 12pt;">Can you increase the size of a linked list?&nbsp;</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>Yes, the size of a linked list can be increased. The size is increased at the runtime.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q44. </span><span style="font-size: 12pt;">Can you increase the size of an array?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>No, the size of an array cannot be increased.&nbsp;</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q45. </span><span style="font-size: 12pt;">Is linked list a linear data structure or a non-linear data structure?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>A linked list is considered as a linear data structure and a non-linear data structure. Based on the usage and the situation, the linked list can be aligned.&nbsp;</span></p>
<p><span style="font-size: 12pt;">Based on data storage criteria, a linked list is considered as a non-linear data structure.</span></p>
<p><span style="font-size: 12pt;">Based on the access strategy, a linked list is considered as a linear data structure.</span></p>
<h3><span style="color: #e67e23;"><span style="font-size: 12pt;">Q46. </span><span style="font-size: 12pt;">Give examples of Multi-linked structures?</span></span></h3>
<p><span style="font-size: 12pt;"><strong style="text-align: justify;">Ans: </strong>The following are examples of multi-linked structures</span></p>
<ul>
<li><span style="font-size: 12pt;">Generating index</span></li>
<li><span style="font-size: 12pt;">Sparse matrix</span></li>
</ul>1a:T19ee,<p style="text-align: justify;">Welcome to Advanced Java Tutorial. The intent of these tutorials is to provide good understanding of Advanced Java.</p>
<p style="text-align: justify;">In addition to free Advanced Java Tutorial, we will cover common interview questions, issues and how to&rsquo;s of Advanced Java.</p>
<h2 style="text-align: justify;"><strong>Introduction</strong></h2>
<p style="text-align: justify;">Core java is having the concept of Java<strong>&nbsp;</strong>Fundamentals, Applet, Swings, JDBC, JavaBeans. Used for developing general java<strong>&nbsp;</strong>application where as Advanced java is used for developing the web based application and enterprise application. Advance java is specialization such as in web, DCOM, or data base handling.</p>
<p style="text-align: justify;">Java programming language has continued to grow both in popularity and scope since its initial release. Java in its current form is the culmination of several years work, dating back to 1991 when it was conceived as a modular and <a class="zem_slink" title="Extensible programming" href="http://en.wikipedia.org/wiki/Extensible_programming" target="_blank" rel="nofollow">extensible programming language</a>.</p>
<p style="text-align: justify;">Java is based on the C and C++ programming languages, but differs from these languages is some important ways. The main difference between C/C++ and Java is that in Java all development is done with objects and classes. This main difference provides distinct advantages for programs written in Java, such as multiple threads of control and dynamic loading.</p>
<p style="text-align: justify;">Another advantage to Java is its extensibility. Since the original release of Java, several extensions have been added to the core code, providing greater flexibility and power to applications. These extensions add objects and classes that improve the Java programmer's ability to use such features as:</p>
<ul>
<li style="text-align: justify;"><span style="color: #236fa1;"><a class="zem_slink" style="color: #236fa1;" title="Java Swing tutorial" href="https://tekslate.com/java-swing-tutorial" target="_blank">Java Swing</a></span> - a component set to create graphical user interfaces with a cross-platform look and feel</li>
<li style="text-align: justify;">Java Sound - for high-quality 32-channel audio rendering and MIDI-controlled sound synthesis</li>
<li style="text-align: justify;">Java 3D - for advanced geometry and 3D spatial sound</li>
<li style="text-align: justify;">Java Media Framework - for components to play and control time-based media such as audio and video</li>
<li style="text-align: justify;">Java Telephony (JTAPI) - for computer-telephony applications</li>
<li style="text-align: justify;">Java Speech - for including speech technology into Java applets and applications</li>
</ul>
<h2 style="text-align: justify;"><strong>The Evolution of Imaging in Java</strong></h2>
<p style="text-align: justify;">Early versions of the <a class="zem_slink" title="Abstract Window Toolkit" href="http://en.wikipedia.org/wiki/Abstract_Window_Toolkit" target="_blank" rel="nofollow">Java AWT</a> provided a simple rendering package suitable for rendering common HTML pages, but without the features necessary for complex imaging. The early AWT allowed the generation of simple images by drawing lines and shapes. A very limited number of image files, such as GIF and JPEG, could be read in through the use of a <code>Toolkit</code> object. Once read in, the image could be displayed, but there were essentially no image processing operators.</p>
<p style="text-align: justify;">The <a class="zem_slink" title="Java 2D" href="http://en.wikipedia.org/wiki/Java_2D" target="_blank" rel="nofollow">Java 2D</a> API extended the early AWT by adding support for more general graphics and rendering operations. Java 2D added special graphics classes for the definition of geometric primitives, text layout and font definition, color spaces, and image rendering. The new classes supported a limited set of image processing operators for blurring, geometric transformation, sharpening, contrast enhancement, and thresholding. The Java 2D extensions were added to the core Java AWT beginning with the Java Platform 1.2 release.</p>
<p style="text-align: justify;">The Java Advanced Imaging (JAI) API further extends the Java platform (including the Java 2D API) by allowing sophisticated, high-performance image processing to be incorporated into Java applets and applications. JAI is a set of classes providing imaging functionality beyond that of Java 2D and the Java Foundation classes, though it is compatible with those <a class="zem_slink" title="Application programming interface" href="http://en.wikipedia.org/wiki/Application_programming_interface" target="_blank" rel="nofollow">APIs</a>.</p>
<p style="text-align: justify;">JAI implements a set of core image processing capabilities including image tiling, regions of interest, and deferred execution. JAI also offers a set of core image processing operators including many common point, area, and frequency-domain operators.</p>
<p style="text-align: justify;">JAI is intended to meet the needs of all imaging applications. The API is highly extensible, allowing new image processing operations to be added in such a way as to appear to be a native part of it. Thus, JAI benefits virtually all Java developers who want to incorporate imaging into their applets and applications.</p>
<h2 style="text-align: justify;"><strong>Outline</strong></h2>
<p style="text-align: justify;"><strong>1. Working with Swing:</strong> Your first Swing application, Event Handling, Inner Classes, the Graphics2D object, Layout Managers, Action Events, Swing components...</p>
<p style="text-align: justify;"><strong>2. Threading: </strong>Basic threads, running multiple threads, thread-safe programming, synchronised methods and -locking</p>
<p style="text-align: justify;"><strong>3. Basic <a class="zem_slink" title="XML" href="https://tekslate.com/xml" target="_blank">XML</a> processing in XML:&nbsp;</strong>Introduction to XML, generating XML data, introduction to the different ways of processing XML in Java (DOM, SAX, Stax, <a class="zem_slink" title="Java Architecture for XML Binding" href="http://en.wikipedia.org/wiki/Java_Architecture_for_XML_Binding" target="_blank" rel="nofollow">JAXB</a>), and a more detailed look at annotation-based XML processing with JAXB.</p>
<p style="text-align: justify;"><strong>4. Web Services in Java: </strong>Introduction to Web Services, writing annotation-based web services with JAX-WS 2.0.</p>1b:T12ce,<p>&nbsp;</p>
<h2><strong>Circular Queue</strong></h2>
<p>The Regular, static queues&nbsp; in data structures have a very big drawback, that once the queue is FULL, even though we delete few elements. From the &ldquo; &nbsp;front&rdquo; and relive some occupied space, we are not able to add anymore elements, as the &ldquo;rear&rdquo; has already reaches the queues rear most partition. To overcome this drawback we can implement the queue as a circular queue. Here as we go on adding elements to the queue and reach the end of the array, the next element is stored in the first slot of the array (provide it is free). As the name suggests, this queue is not straight but circular; meaning; you go to have a following structure like this &nbsp; <img class="alignnone size-full wp-image-6533" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/1110.png" alt="11" width="309" height="254" /> &nbsp; &nbsp; &nbsp; Initially when such a circular queue is empty ,the &ldquo;Front&rdquo; and the &ldquo;rear&rdquo; values are-1 and -1 respectively; and the queue has a null value of all us element. Every time we add on element to the queue the &ldquo;rear&rdquo; value increments by 1 till the time it reaches the upper limit of queue; after which it starts all over again from&rsquo;0&rsquo; Similarly, every time we delete an element from queue, the &ldquo;front&rdquo; value increments by till the time it reaches the upper limit of queue. After which&nbsp; it starts all over again from &lsquo;0&rsquo;. &nbsp;</p>
<h4><strong>Program :</strong></h4>
<p>Implementation at circular Queue # include &lt;stdio.h&gt; # include &lt;conio.h&gt; # include &lt;stdlib.h&gt; # define max 5 Int rear = -1; Int front = -1; Int cq [max]; Void insertion() { Int item; If(( front == 0)&amp;&amp; (rear==max-1)||(front==rear +1)) { Print (&ldquo;Queue is overflow \n&rdquo;) } Else { Print (&ldquo;enter the value&rdquo;) Scanf(&ldquo;%d&rdquo;, &amp; item); If(front ==-1); { Font =0; Rear =0; } Else { If(rear == max-1) { Rear=0; } Else { Rear = rear+1 Cq[rear] = item; } } Void deletion() Int item; If(front==-1) { Printf(&ldquo;Queue is underflow \n&rdquo;); } Else Item = cq[front]; Printf(&ldquo;the deleted item is:%d,&rdquo;item); Cq[front] =0; If(front== rear) { Front=-1; Rear= -1; } Else { If(front== max-1) { Front=0; } Else { Front= front+1; } } } void display () { int i; for(i=0; i&lt;=max;i++) { printf(&ldquo;%d&rdquo;,cq[i]);} } } void main() { int op; clrscr(); printf(&ldquo;1.insertion \n&rdquo;); printf(&ldquo;2. Deletion \n&rdquo;); printf(&ldquo;3. Display \n&rdquo;) ; printf(&ldquo;4. Exit \n&rdquo;); do { printf(&ldquo;Enter your option \n&rdquo;); scanf(&ldquo;%d&rdquo;, &amp;op); switch(op) { case 1: insertion (); break; case 2: Deletion (); break; case 3: display (); break; case 4: exit; break; } while(op&lt;=4) } } &nbsp;</p>
<h4>1). Initial State:</h4>
<p><img class="alignnone wp-image-6525" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/124-460x223.png" alt="12" width="434" height="210" /> &nbsp;</p>
<h4>2). After inserting element 10</h4>
<p><img class="alignnone wp-image-6540" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/134-460x273.png" alt="13" width="379" height="225" /> &nbsp; &nbsp;</p>
<h4>3). After Inserting elements 20,30,40,50...</h4>
<p><img class="alignnone wp-image-6541" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/144-460x243.png" alt="14" width="403" height="212" /> &nbsp;</p>
<h4>4). Inserting element 60</h4>
<p>Circular Queue is overflow &nbsp;</p>
<h4>5). After deleting elements 10,20</h4>
<p><img class="alignnone wp-image-6542" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/153-460x243.png" alt="15" width="454" height="239" /> &nbsp;</p>
<h4>7).After inserting element 60,70</h4>
<p><img class="alignnone wp-image-6543" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/163-460x243.png" alt="16" width="387" height="204" /> &nbsp;</p>
<h4>8). After Deleting elements 30,40</h4>
<p><img class="alignnone size-full wp-image-6544" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/173.png" alt="17" width="317" height="267" /> &nbsp; &nbsp;</p>
<h4>9). After deleting 50</h4>
<p><img class="alignnone size-full wp-image-6545" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/174.png" alt="17" width="317" height="267" /> &nbsp;</p>
<h4>10).Ater deleting 60,70</h4>
<p><img class="alignnone wp-image-6546" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/175-460x262.png" alt="17" width="339" height="192" /> &nbsp; &nbsp;</p>1c:T706,<h2><strong>Linear search</strong></h2>
<p>The linear search in data structures&nbsp;&nbsp;or the sequential searching is most simple searching method. The key which is to be searched, is compared with each element of the list one by one in Linear Search If a match exits, the search is terminated in Linear Search If the end of the list is reached, it means that the search has failed and the key has no matching element in the list. &nbsp; <strong>ex:</strong> <img class="alignnone size-full wp-image-6555" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/203.png" alt="20" width="394" height="283" /> &nbsp;</p>
<h3><strong>Program :&nbsp; </strong></h3>
<p>Linear search # include &lt;stdio.h&gt; # include &lt;conio.h&gt; int linear(int a[20]),int n, int key); void main() { int a[20],n,i,key,p; clrscr(); printf(&ldquo;Enter the value \n&rdquo;); for (i=0; i&lt;n; i++) { scanf(&ldquo;%d&rdquo;,&amp;key); } printf (&ldquo;Enter the search element \n&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;key); p=liner(a,n,key); if(p&gt;=0) { printf(&ldquo;The element found at %d position&rdquo;,p+1); } else printf(&ldquo;The element is not found&rdquo;); getch(); } int linear(int a[20], int n, int key) { int i=0; while(i&lt;n) { if(a[i]==key) { return j; } i++; } return i; } &nbsp;</p>
<h3><strong>Time complexity</strong><strong>: </strong></h3>
<p>In the worst case(i.e when there)&nbsp; N&nbsp; comparisons are required hence the worst case performance represented as o(n); The best case in which the first comparison returns a match, it requires a single comparison and hence it is o(1) The average case roughly requires N/2 comparisons to search the element. That means the average time, as in worst-case is proportional to N and hence is o(n) &nbsp; &nbsp;</p>1d:T119d,<h2><span style="font-size: 24px; color: #e67e23;"><strong>Evaluation of a Postfix Expression</strong></span></h2>
<p>Suppose p is an arithmetic expression written in postfix notation. The following algorithm, which user a STACK to held operands, evaluates P.<strong>&nbsp;</strong> <strong>&nbsp;</strong> <strong>Algorithm</strong> This algorithm finds the value of an arithmetic expression P written in postfix notation</p>
<ol>
<li>Add a right parenthesis &ldquo;)&rdquo; at the end of p [This acts of a sentinel]</li>
<li>Scan p from left to right and repeat steps 3 and 4 for each element of p until the sentinel &rdquo;)&rdquo; is encountered.</li>
<li>if an operand is encountered, put it on STACK</li>
<li>If an operator X is encountered, Then :</li>
<li>Remove the two top elements of STACK, where A is the top element and B is the next to top element</li>
<li>Evaluate BXA</li>
<li>Place the result of (b) back on STACK [End of if structure] [End of step2 loop]</li>
<li>A set value equal to the top element on STACK</li>
<li>Exit</li>
</ol>
<p>Not that, when step 5 is executed, There should only be one number on STACK.</p>
<h3><strong>Example:&nbsp; </strong></h3>
<p>ABC+*DE/- a=5, B=6,c=2,D=12,E=4 &nbsp;</p>
<table>
<tbody>
<tr>
<td width="319"><strong>Symbol scanned</strong></td>
<td width="319"><strong>STACK</strong></td>
</tr>
<tr>
<td width="319">
<ol>
<li>A</li>
</ol>
</td>
<td width="319">5</td>
</tr>
<tr>
<td width="319">
<ol start="2">
<li>B</li>
</ol>
</td>
<td width="319">5&nbsp; 6</td>
</tr>
<tr>
<td width="319">
<ol start="3">
<li>C</li>
</ol>
</td>
<td width="319">5 6 2</td>
</tr>
<tr>
<td width="319">
<ol start="4">
<li>+</li>
</ol>
</td>
<td width="319">5&nbsp; 8</td>
</tr>
<tr>
<td width="319">
<ol start="5">
<li>*</li>
</ol>
</td>
<td width="319">40</td>
</tr>
<tr>
<td width="319">
<ol start="6">
<li>D</li>
</ol>
</td>
<td width="319">40&nbsp;&nbsp;&nbsp; &nbsp;12</td>
</tr>
<tr>
<td width="319">
<ol start="7">
<li>E</li>
</ol>
</td>
<td width="319">40&nbsp;&nbsp;&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4</td>
</tr>
<tr>
<td width="319">
<ol start="8">
<li>/</li>
</ol>
</td>
<td width="319">40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;3</td>
</tr>
<tr>
<td width="319">
<ol start="9">
<li>-</li>
</ol>
</td>
<td width="319">37</td>
</tr>
</tbody>
</table>
<p>&nbsp; &nbsp;</p>
<h3><strong>Postfix expression Program </strong></h3>
<pre class="language-markup"><code>#include &lt;stdio.h&gt;
#include &lt;conio.h&gt;
#include &lt;string.h&gt;

char postfix[20];
int stack[20];
int top = -1;

void get_postfix_expr() {
    printf("Enter the postfix expression: ");
}

switch(postfix[i]) {
    case '-':
        stack[top] = B - A;
        top--;
        break;
    case '*':
        stack[top-1] = B * A;
        top--;
        break;
    case '/':
        stack[top-1] = B / A;
        top--;
        break;
}

void calculate() {
    int i, A, B;
    for (i = 0; postfix[i] != '\0'; i++) {
        if (postfix[i] &gt;= '0' &amp;&amp; postfix[i] &lt;= '9') {
            stack[++top] = postfix[i] - '0';
        } else {
            B = stack[top--];
            A = stack[top--];
            switch(postfix[i]) {
                case '+':
                    stack[++top] = A + B;
                    break;
                case '-':
                    stack[++top] = B - A;
                    break;
                case '*':
                    stack[++top] = B * A;
                    break;
                case '/':
                    stack[++top] = B / A;
                    break;
            }
        }
    }
}

void display() {
    printf("Result = %d", stack[top]);
}

int main() {
    clrscr();
    get_postfix_expr();
    calculate();
    display();
    return 0;
}
</code></pre>
<h3><strong>Output:</strong></h3>
<pre class="language-markup"><code>Enter the postfix expression: ABC+*DE/-
Enter the value of A: 5
Enter the value of B: 6
Enter the value of C: 2
Enter the value of D: 1
The calculated value is: 33
</code></pre>
<ul>
<li>The postfix expression <code>ABC+*DE/-</code> is entered as input.</li>
<li>The values of A, B, C, and D are entered as 5, 6, 2, and 1 respectively.</li>
<li>The <code>calculate()</code> function evaluates the postfix expression and pushes the result onto the stack.</li>
<li>The <code>display()</code> function prints the top element of the stack, which is the calculated value of the postfix expression.</li>
<li>The output shows that the calculated value is 33.</li>
</ul>1e:Ta70,<h2><strong>Selection sort</strong></h2>
<p>Suppose an array A with &lsquo;n&rsquo; elements A[0],A[1],A[2]&hellip;.. is in memory. The selection sort algorithm in data structures&nbsp;for sorting &lsquo;A&rsquo; works as follows <strong>Pass 1:</strong> &nbsp;First find the smallest element in the list and put it into the first position. Then find the second smallest element in the list of &lsquo;N&rsquo; elements A[0],A[1],A[2]------ and then interchange A[Loc] and A[0] is sorted. <strong>Pass 2:</strong> Find the location LOC of the smallest in the sub list of n-1 elements A[1],A[2],A[3] then A[0],A[1] sorted <strong>Pass N-1:</strong> Find the location LOC of the smaller of the elements A[N-1], A[N] and then interchange A[LOC] and A[N-1] then : A[0],A[1],A[2]----- &nbsp;is sorted. <img class="alignnone wp-image-6571" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/243-460x283.png" alt="24" width="471" height="289" /> &nbsp;</p>
<h3><strong>&nbsp;Selection Sort Program</strong></h3>
<p>Implementation of selection sort # include&lt;stdio.h&gt; void selection sort(int a[],int n); void main() { int a[20],n,i; clrscr(); printf(&ldquo;Enter n value \n&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;n); printf(&ldquo;Enter those numbers \n&rdquo;); for (i=0;i&lt;n;i++) { scanf(&ldquo;%d&rdquo;,&amp;a[i]); } selection sort(a,n); printf(&ldquo;Following are the elements in sorting orger: \n&rdquo;); for(i=0;i&lt;n;i++) { printf(&ldquo;%5d&rdquo;,a[i]); } } void selection sort(int a[], int n) { int i, min Loc, t,j; for(i=0;i&lt;n-1;i++) { MinLOC=i; for(j=i+1; j&lt;n;j++) { if(a[j]&lt;a[minLoc]) minLoc=j; } t=a[i]; a[i]=a[MinLoc]; a[MinLoc]=t; } } &nbsp;</p>
<h3><strong>Time complexity</strong><strong> :</strong></h3>
<p>Complexity of the selection sort algorithm f(n)=(n-1)+(n-2)+-------- +2+1=n(n-1)/2=0(n<sup>2</sup>) &nbsp;</p>
<table>
<tbody>
<tr>
<td width="213">Algorithm</td>
<td width="213">Worst cape</td>
<td width="213">Average cape</td>
</tr>
<tr>
<td width="213">selection sort</td>
<td width="213">n(n-1)/2=o(n<sup>2</sup>)</td>
<td width="213">n(n-1)/2=o(n<sup>2)</sup></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h3><strong>Output:</strong></h3>
<p>Enter n value : 7 Enter those numbers : 60&nbsp;&nbsp;&nbsp;&nbsp; 30&nbsp;&nbsp;&nbsp;&nbsp; 20&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp; 50&nbsp;&nbsp;&nbsp;&nbsp; 70&nbsp;&nbsp;&nbsp;&nbsp; 40 &nbsp; Following are the elements in the sorting order: 10&nbsp;&nbsp;&nbsp;&nbsp; 20&nbsp;&nbsp;&nbsp;&nbsp; 30&nbsp;&nbsp;&nbsp;&nbsp; 40&nbsp;&nbsp;&nbsp;&nbsp; 50&nbsp;&nbsp;&nbsp;&nbsp; 60&nbsp;&nbsp;&nbsp;&nbsp; 70 &nbsp; &nbsp; &nbsp; &nbsp;</p>1f:Tb72,<h2><strong>Insertion sort</strong></h2>
<p>Suppose an array &lsquo;A&rsquo; with &lsquo;n&rsquo; elements A[0]. A910,A[20],---------A[N-1] is in memory. The insertion sort algorithm&nbsp;in data structures&nbsp;scans &lsquo;A; from A[0] to A[N-1] insert each element A[k] into its proper position in the previously sorted sub array A[0],A[1],A[2]---- A[K]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; That is pass1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A[0] by itself ip trivially sorted. pass2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A[1] is inserted either before or after aA[0] So that : A[0],A[1] is sorted pass3: A[2] is inserted into its proper place in A[1] A[2], that is before A[0] between A[0] A[1] or after A[1], so that : A[0],A[1],A[2] is sorted pass4: [3] is inserted into its proper place in A[1],A[2] so that : A[0],A[1],A[2],A[3] is sorted. PassN : A[N] is inserted into its proper place in A[1],A[2],-------A[N-1] so that : A[0],A[1]--- is sorted. &nbsp; <strong>Example :</strong> &nbsp; <img class="alignnone wp-image-6576" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/252-460x256.png" alt="25" width="493" height="273" /> &nbsp;</p>
<h3><strong>Insertion Sort Program</strong></h3>
<p>Implementation of insertion sort in data structures # include &lt;stdio.h&gt; # include &lt;conio.h&gt; void main() { int n,i,j,a[20],temp; void insertion sort(int&nbsp; a[10],int n); clrscr(); printf(&ldquo;Enter n value: &rdquo;); scanf(&ldquo;%d&rdquo;,&amp;n); printf(&ldquo;Enter the elements:\n&rdquo;); for(i=0; i&lt;n;i++) { scanf(&ldquo;%d&rdquo;,&amp;a[i]); } Insertion sort(a,n); } insertion sort(a,n); printf(&ldquo;The sorted elements are:\n&rdquo;); for(i=0;i&lt;n;i++) { printf(&ldquo;%5d&rdquo;,a[i]); } } void insertion sort (int a[20], int n) { int i,j,temp; for(i=1;i&lt;n;i++) { if(a[j]&lt;a[j-1]) { temp=a[j]; a[j]=a[j-1]; a[j-1]=temp; } } } }</p>
<h3><strong>output :</strong></h3>
<p>Enter &lsquo;n&rsquo; value : 5 Enter the elements:&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 The elements are :&nbsp; 2&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5 &nbsp; &nbsp; <strong>Time complexity</strong><strong> :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong></p>
<table>
<tbody>
<tr>
<td width="213">Algorithm</td>
<td width="213">Worst case</td>
<td width="213">Average case</td>
</tr>
<tr>
<td width="213">Insertion sort</td>
<td width="213">n(n+1)/2=o(n<sup>2)</sup></td>
<td width="213">n(n-1)/4=o(n<sup>2</sup>)</td>
</tr>
</tbody>
</table>
<p>&nbsp; &nbsp;</p>20:Tcc0,<h2><strong>Quick sort </strong></h2>
<p>The&nbsp;following&nbsp;are the steps to set up Quick Sort in Data Structures.</p>
<ol>
<li>Select first moment of Array A(or sub array) as pivot.</li>
<li>Initiative and J to first and last elements of the array respectively.</li>
<li>Increment &nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; until&nbsp; A[i]&gt;pivot;stop</li>
<li>Decrement :&nbsp;&nbsp;&nbsp;&nbsp; until A[j]&lt;pivot,stop</li>
<li>if i&lt;j &nbsp;&nbsp;&nbsp; : change A[i] and A[j]</li>
<li>Repeat statements 3,4 and 5 until i&gt;j, i.e when i and j cross each other.</li>
<li>Exchange the pivot element with the element pointed to by J which is correct place for pivot</li>
</ol>
<p>Note that in step 7, The swapping keeps the larger element to the right and smaller element to the left, relative to the pivot. &nbsp; &nbsp; <strong>Example:</strong> <img class="alignnone size-full wp-image-6579" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/263.png" alt="26" width="443" height="291" /> <img class="alignnone size-full wp-image-6580" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/264.png" alt="26" width="378" height="236" /> <img class="alignnone size-full wp-image-6581" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/273.png" alt="27" width="379" height="291" /> <img class="alignnone size-full wp-image-6582" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/274.png" alt="27" width="390" height="323" /> <img class="alignnone size-full wp-image-6583" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/275.png" alt="27" width="327" height="69" /> &nbsp;</p>
<h3><strong>Quick Sort Program</strong></h3>
<p>Implementation of Quick sort # include&lt;stdio.h&gt; void Quick sort(int k[], int lb,int vb); void main() { int a[20]; int n,i; clrscr(); printf(&ldquo;How many numbers:&rdquo;); scanf(&ldquo;%d&rdquo;, &amp;n); printf(&ldquo;\n Enter the numbers: \n&rdquo;); for(i=0;i&lt;n;i++) { scanf(&ldquo;%d&rdquo;,a[i]); } quicksort(a,o,n-1); printf(&ldquo;The following are the sorted elements :\n&rdquo;); for(i=0;i&lt;n;i++) { printf(&ldquo;%d&rdquo;,a[i]); } getch(); } void quick sort(int k[], int lb, int vb) { int flag; int i,j,key; flag=1; if(lb&lt;ub) { int temp; i=lb+1; j=ub; key=k[lb]; &nbsp; while(flag) { while(k[i]&lt;key&nbsp;&nbsp;&nbsp;&nbsp; &amp;&amp;&nbsp;&nbsp;&nbsp; i&lt;ub) i=i+1; While(k[j]&gt;key &nbsp;&nbsp; &amp;&amp;&nbsp;&nbsp;&nbsp; j&gt;lb) j=j-1; if(i&lt;j) { temp=k[j]; k[j]=k[i]; k[i]=temp; } else flag=0; } temp=k[lb]; k[lb]=k[j]; k[j]=temp; quicksort(k,lb,j-1); quicksort(k,j+1,ub); } }</p>
<h3><strong>Output:</strong></h3>
<p>How many numbers : Enter the numbers: &nbsp;</p>
<h3><strong>Time complexity</strong><strong>:</strong></h3>
<p>The running time of sorting algorithm is usually measured by the number f(n) of comparison required to sort &lsquo;n&rsquo; elements, the quick sort algorithm which has many variations as been studied extensively generally speaking, The algorithm has a worst case running time of order n<sup>2</sup>/2=o(n<sup>2</sup>) it&rsquo;s an average cape running time of order o(nlogn) &nbsp;</p>21:Tc56,<h2><strong>Heap Sort</strong></h2>
<p>&nbsp; <strong>Building Heap </strong> &nbsp;</p>
<ol>
<li>start with just one, element one element will always, satisfy heap property.</li>
<li>Insert next elements and make this a heap</li>
<li>Repeat step b until all elements are include in the heap</li>
</ol>
<p>&nbsp; <strong>Sorting</strong> &nbsp;</p>
<ol start="2">
<li>Exchange the root name the last element in the heap</li>
<li>Make this a heap agar, but this time do not include the last node.</li>
<li>Repeat step a and b until there is no element left</li>
</ol>
<p>&nbsp; &nbsp;</p>
<h4><strong>Example</strong></h4>
<p>set the following elements in ascending order using heap sort 4,8,9,5.6 &nbsp; A</p>
<table>
<tbody>
<tr>
<td width="47">4</td>
<td width="47">8</td>
<td width="47">3</td>
<td width="47">9</td>
<td width="47">5</td>
<td width="47">6</td>
</tr>
<tr>
<td width="47">1</td>
<td width="47">2</td>
<td width="47">3</td>
<td width="47">4</td>
<td width="47">5</td>
<td width="47">6</td>
</tr>
</tbody>
</table>
<p>&nbsp; &nbsp;</p>
<h3>Build Heap</h3>
<p><img class="alignnone size-full wp-image-6587" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/282.png" alt="28" width="303" height="417" /> <img class="alignnone wp-image-6589" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/283-460x836.png" alt="28" width="363" height="660" /> &nbsp;</p>
<h3><strong>Sorting</strong></h3>
<p><img class="alignnone wp-image-6590" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/293-460x396.png" alt="29" width="460" height="396" /> &nbsp; &nbsp; <strong>Program :</strong> Implementation of Heap Sort # include&lt;stdio.h&gt; void Heapsort(int a[],int n); void Build Heap(int a[],int n); void Reheap(int a[],int k); void main() { in a[20],n,i; printf(&ldquo;Enter N value \n&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;n); printf(&ldquo;Enter those numbers: \n&rdquo;); for(int i=1; i&lt;=n; i++) { scanf(&ldquo;%d&rdquo;,&amp;a[i]); } Heap sort(a,n); printf(&ldquo; The following are the sorted elements. \n&rdquo;); for(i=1;i&lt;=n;i++) { printf(&ldquo;%d&rdquo;,a[i]); } } void Heap sort(int a[],int n) { int fs,temp; Build Heap(a,n); for(pos=n;pos&gt;=2;pos--) { temp=a[1]; a[1]=a[pos]; a[pos]=temp; Reheap(a,pos-1); } } void Build Heap(int a[],int n) { for(j=2;j&lt;=n;j++) { key=a[i]; i=j/2; while((i&gt;0) &amp;&amp; (a[i]&lt;key)) { a[j]=a[i]; j=i; i=j/2; } a[j]=key; } a[j]=key; } } void Reheap(int a[], int k) { int parent, child, key, heap; parent=1; child=2; Key=a[parent]; heap=0; while((child&lt;=k) &amp;&amp; (!heap)) { if(child&lt;k) { if(a[child+1]&gt;a[child]) child=child+1; } if(a[child]&gt;key) { a[parent]=a[child]; parent=child; child=parent*2; } else { heap=1; } } a[parent]=key; } &nbsp;</p>
<h3><strong>Time complexity</strong><strong> :</strong></h3>
<p>Since each phase require time proportional to nlog<sub>2</sub>n, The running time to sort the n-element array using heap sort is proportional to nlog<sub>2</sub>n, that is f(n)=0(nlog<sub>2</sub>n) the average running time of heap sort is o(nlog<sub>2</sub>n)</p>22:T29e8,<h2><strong>Linked List</strong></h2>
<h3><strong>&nbsp;</strong></h3>
<p>The term &ldquo;list&rdquo; refers to a linear collection of data items. One way to store such data is by means at &ldquo;array&rdquo; . The array implementation of list hap certain draw backs there are</p>
<ol>
<li>Memory storage space is wasted, very often the list is much stories than the array size declared.</li>
<li>List cannot grow in its size beyond the size at the declared array i.e required during paragraph execution.</li>
<li>Operations like insertion and declaration as a specified location in&nbsp; a list requires a lot of movement of data, Therefore leading to inefficient and time containing algorithm</li>
<li>Another way of storing a list in memory is by means of linked list. Each element in the list contain a field, called a link fields, Which contains the address of the next elements in the list need not occupy adjacent space in memory. Thus will make it easier to insert and delete element in the list.</li>
</ol>
<p>&nbsp; &nbsp;</p>
<h3><strong>Advantages of linked list over arrays</strong><strong>:</strong></h3>
<ol>
<li>Linked list is a dynamic structure where as array is a static structure. That is the size of the array is fixed, it cannot be increased or decreased during execution of a program.</li>
<li>In portion and deletion of nodes require no data movement</li>
<li>Joining two arrays is very tedious process because these is lot of data movement, where of joining two linked list is very easy.</li>
</ol>
<h3><strong>Types of linked list</strong> :</h3>
<p>These are 3 types.</p>
<ol>
<li>Singly linked list</li>
<li>Doubly linked list</li>
<li>Circular linked list</li>
</ol>
<p>&nbsp;</p>
<h3><strong>Singly linked list:</strong></h3>
<ul>
<li>A singly linked list or one way list is a linear collection of data elements, called nodes</li>
<li>Here each node is dividing into two fields.</li>
<li>The first filed containing the information of the element, and the second field contains the address in the next node in the list.</li>
<li>The first filed is called &ldquo;Data field &rdquo; and the second field is called &ldquo;Link field&rdquo;</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-6593" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/303-460x123.png" alt="30" width="401" height="107" /> &nbsp;</p>
<ul>
<li>The left part represents information part of the node the right part represents the link field of the node.</li>
</ul>
<ul>
<li>The pointer to the last node contains a special value called &ldquo;NULL&rdquo; pointer.</li>
<li>Linked list also contains a pointer variable, called HEAD, which points to the first node of the list</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-6594" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/317-460x215.png" alt="31" width="467" height="218" /> &nbsp;</p>
<h3><strong>Inserting at an element in list</strong><strong>:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong></h3>
<ol>
<li>Inserting at the beginning of the list :</li>
</ol>
<ul>
<li>Suppose a node N is to be inserted into the list at beginning as Shan in the fig. The simplest strategy for an item at the beginning at the list ip to:</li>
</ul>
<ol>
<li>Allocate space for a new node.</li>
<li>Copy the item to be inserted into it.</li>
<li>Make the new nodes next pointer point to the current head of the list</li>
<li>Make the HEAD of the list point to the newly allocated node.</li>
</ol>
<ol style="list-style-type: lower-roman;">
<li>cur -&gt; Link = Head</li>
<li>Hand = Cur;</li>
</ol>
<p>&nbsp; <img class="alignnone wp-image-6597" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/323-460x192.png" alt="32" width="528" height="220" /> &nbsp; &nbsp;</p>
<h3><strong>Insertion After a give node :</strong></h3>
<p>To insert a node in the linked list we need to specify the element to be inserted and the element in the list after which the element has to be inserted.</p>
<ol>
<li>Search for the element after which the insertion is to be done.</li>
<li>Create a memory space for element to be inserted.</li>
<li>Assign the data value its data field.</li>
<li>Assign is a pointer to pointer of the element searched at step 2</li>
<li>Assign pointer of the element searched at step 2to this new element started.</li>
</ol>
<p>&nbsp; &nbsp;</p>
<ol style="list-style-type: lower-roman;">
<li>cur&nbsp;&nbsp;&nbsp; - &gt;&nbsp; Link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = ptr -&gt; Link;</li>
<li>ptr&nbsp;&nbsp;&nbsp;&nbsp; - &gt; Link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =cur;</li>
</ol>
<p>&nbsp; <img class="alignnone wp-image-6598" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/333-460x269.png" alt="33" width="511" height="298" /> &nbsp;</p>
<h3><strong>Deletion Operation</strong><strong> :</strong></h3>
<p><strong>Deleting Beginning Node:</strong></p>
<ol>
<li>Store the first &ldquo;link field&rdquo; in the &ldquo;HEAD&rdquo; pointer</li>
<li>Disappear the memory space held by the deleted element</li>
</ol>
<p>Head=Head - &gt; Link free(otr); <img class="alignnone wp-image-6599" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/342-460x142.png" alt="34" width="375" height="115" /> &nbsp;</p>
<h3><strong>Deleting a specified node:</strong></h3>
<p>&nbsp;</p>
<ol>
<li>Search for the element with key value same as the element to be deleted.</li>
<li>Its pointer to next element be saved and late assigned to next element of predecessor of the element searched at step.</li>
<li>Dispose the memory space held by the deleted element.</li>
</ol>
<p>ptr1=ptr &agrave;link; ptr &agrave; link= ptr1 &agrave;link; free(ptr1); &nbsp; <img class="alignnone wp-image-6600" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/352-460x153.png" alt="35" width="433" height="143" /> &nbsp;</p>
<h3><strong>Linked List Program</strong></h3>
<p>Implementation of singly linked list # include &lt;studio.h&gt; #include &lt;conio.h&gt; #include&lt;stdlib.h&gt; struct Node { int Data; struct Node *link; }; struct Node*Head; void createList() { int else; struct Node*ptr,*cur; Head=NULL; printf(&ldquo;Enter Data for the Node -1): &ldquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); while(ele!=-1) { cur=(struct Node*)malloc (size of (structNode)); cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;Data=ele; cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />Link=NULL; if (Head==NULL) Head=cur; else ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link =cur; ptr=cur; printf(&ldquo;Enter Data For The Node -1):&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); } } void Insertion() { int ele,x; char ch; struct Node*ptr,*cur; ptr=Head; cur=(structNode *) malloc (size of (structNode)); printf(&ldquo;Enter Data for the New Node:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;x); cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;Data=x; cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />Link=NULL; printf(&ldquo;Do you want to insert first(y\n:&rdquo;); fflush(stdin); scanf(&ldquo;%c&rdquo;,&amp;ch); if((ch==&rsquo;y&rsquo;) || (ch==&rsquo;n&rsquo;)) { cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =Head; Head =cur; } else { printf(&ldquo;After which element you want to Insert:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); while(ptr!=NULL) { if(ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;Data ==ele) { cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;Link =ptr &agrave; Link; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;Link= cur; break; } else { ptr =ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />Link; } } } } void Deletion () { int ele; char ch; struct Node*ptr,*ptr1; ptr=Head; printf(&ldquo;Do you want to Delete First (Y/n):&rdquo;); scanf(&ldquo;%c&rdquo;,&amp;ch); if(ch==&rsquo;y&rsquo;|| ch==&rsquo;n&rsquo;) { Head=Head <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />Link; free(ptr) } else { printf(&ldquo; which element you want to delete:&rdquo;); scanf(&ldquo;%d&rdquo;, &amp;ele); while(ptr!=NULL) { if(ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> Link &agrave;Data==ele) { ptr1=ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />Link; } } } } void Display() { struct node*ptr; ptr=Head; if(ptr==NULL) { printf(&ldquo;List is Empty \n&rdquo;); } else { while(ptr!=NULL) { printf(&ldquo;%5d&rdquo;,ptr Data); ptr=ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />Link; } } } void main() { int choice; createlist() printf(&ldquo;1.INSERTION \n&rdquo;); printf(&ldquo;2.DELETION&nbsp; \n&rdquo;); printf(&ldquo;3.DISPLAY&nbsp; \n&rdquo;); printf(&ldquo;4.EXIT \n&rdquo;); do { printf(&ldquo;Enter your choice:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;choice); switch (choice) { { case1: insertion (); break; case2: deletion (); break; case3: Display(); break; case4: exit(0); } } while (choice&lt;=4); getch(); } &nbsp; &nbsp;</p>23:Td6d,<h2><strong>Queues using Linked list</strong></h2>
<p>It configures storage (using arrays), queues where harder to manipulate then were stacks. It causes difficulties to handle full queues and empty queues. It is for queues that linked storage really comes into its own The linked implementation has two advantages over the array implementation (1) it is faster locations for insertion and deletion are same at the back and at the front and 2) it wastes no space Linked queues are just as easy to handle as are linked stacks. &nbsp; <img class="alignnone size-full wp-image-6623" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/451.png" alt="45" width="419" height="402" /> &nbsp; <strong>Program</strong><strong>:</strong> Program to implement queue using linked list : # include&lt;stdio.h&gt; #include&lt;conio.h&gt; #include&lt;stdio.h&gt; struct node { int data; struct node *next; }; struct node *front=NULL ;*rear; void insertion() { int els; struct node *new node; new node=(struct node *)malloc(sizeof(struct node)); printf(&ldquo;Enter data for new node: &rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); newnode <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />data=ele; newnode <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />next=NULL; if(front==NULL) { front=new node; rear=front; } else { rear<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> next= new code; rear= new node; } } void deletion() { struct node *temp; if(front==NULL) printf(&ldquo;QUEUE underflow&rdquo;); else { temp=front; front=front <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;next; printf(&ldquo;Deleted element is : %d \n&rdquo;, temp <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data); free(temp); } } void display() { struct node *ptr; if(front===NULL) printf(&ldquo;queue is empty&rdquo;); else { printf(&ldquo;elements of queue are :&rdquo;); for(ptr=front; ptr!=NULL;ptr=ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />next); printf(&ldquo;%5d&rdquo;,ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> data); } } void main() { int ch; clrscr(); do { printf(&ldquo;1. INSERTION \n&rdquo;); printf(&ldquo;2. DELETION \n&rdquo;); printf(&ldquo;3. DISPLAY \n&rdquo;); printf(&ldquo;4.EXIT \n&rdquo;); printf(&ldquo;Enter U r choice :&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ch); switch(ch) { case1: insertion(); break; case2: deletion(); break; case3: display(); break; case 4: exit(0); } } while(ch&lt;=4) getch(); } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>24:T1e08,<h2>Binary Tree</h2>
<p><strong>&nbsp;</strong>A binary trees in data structures T is defined as a finite set of elements, called nodes, such that :</p>
<ol>
<li>T is empty ( called the null tree of empty tree)</li>
<li>T contains a distinguished node R, called the root of T and the remaining nodes of T form an order pair of disjoin binary trees T1 and T2.</li>
</ol>
<p>If T does contain a root R, Then the two trees T1 and T2 are called, respectively the left and right sub trees of R. &nbsp; &nbsp; <img class="alignnone size-full wp-image-6629" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/471.png" alt="47" width="399" height="365" /> &nbsp; &nbsp;</p>
<h3><strong>Differences between a binary tree and a tree</strong><strong> in data structures</strong></h3>
<ul>
<li>A binary tree in data structures&nbsp;can be empty, where as a tree can not</li>
<li>Each element is a binary has exactly two sub trees (one of both of these sub trees may be empty). Each element in a tree can have any number of sub trees.</li>
</ul>
<p>&nbsp; <strong>Algebraic expressions </strong> Following figure shows some binary trees that represent arithmetic expressions. Each operator (+,-,*,/) may have one or two operands The left operand (if any) is the left sub trees of the operator. The right operand is its right sub tree. The right operand is its right sub tree . The leaf element in an expression tree are either constants or variables. Note that an expression tree contains parenthesis One application of expression trees is in the generation of optimal computer code to evaluate an expression &nbsp; Example : (a-b)/(Cc*d)+e)</p>
<ul>
<li>c*d</li>
<li>a-b</li>
<li>1+e</li>
<li>2/3</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-6630" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/481-460x155.png" alt="48" width="555" height="187" /> &nbsp; &nbsp; <strong>Example: </strong> (a*b) + (c/d)</p>
<ol>
<li>a*b</li>
<li>&nbsp;c/d</li>
<li>1+2</li>
</ol>
<p>&nbsp; <img class="alignnone wp-image-6631" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/491-460x220.png" alt="49" width="476" height="227" /> &nbsp; <strong>Example :</strong> ((a+b)+c)+d) <img class="alignnone wp-image-6632" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/50-460x144.png" alt="50" width="497" height="154" /> &nbsp; &nbsp;</p>
<h3><strong>Properties of binary trees</strong></h3>
<ol>
<li>The drawing of every binary tree with n elements, n&gt;0, has exactly n-1 edges.</li>
<li>A binary tree of height h, h&gt;=0, has at least hand at most 2<sup>n-1</sup> elements init.</li>
</ol>
<p>&nbsp;</p>
<h3><strong>&nbsp;Full binary tree &amp; complete binary tree </strong></h3>
<p>A binary tree of height h that contains exactly 2<sup>n-1</sup> elements is called a full binary tree. &nbsp; <img class="alignnone wp-image-6633" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/514-460x143.png" alt="51" width="584" height="181" /> &nbsp; &nbsp; The tree T is said to be complete if all its levels, except possible the last, have the maximum number of possible nodes, and if all the nodes at the last level appear as far left as possible. <img class="alignnone size-full wp-image-6634" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/521.png" alt="52" width="352" height="279" /> &nbsp;</p>
<h3><strong>Representation of Binary trees</strong></h3>
<p>The following are the two ways of representing binary trees</p>
<ul>
<li>Array representation</li>
<li>Linked representation</li>
</ul>
<p>&nbsp;</p>
<ul>
<li>
<h3><strong>Array representation</strong></h3>
</li>
</ul>
<p>Suppose T is a binary tree that is complete or nearly complete or nearly complete. Then there is an efficient representation of T. This representation uses only a single linear array TREE as follows.</p>
<ol>
<li>The root R of T is stored in TREE[1]</li>
<li>If a node N occupies TREE[k]. then the left child is , stored in TREE[2*K] and its right child is stored in TREE[2*(k+1)]</li>
</ol>
<p>Again , Null is used to indicate an empty sub tree in particular, TREE[1]= NULL indicates that the tree is empty. <img class="alignnone wp-image-6635" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/531-460x225.png" alt="53" width="495" height="241" /> &nbsp; This representation schema is quite waste of space when many elements are mission. The array representation is useful only when the number of missing elements is small.</p>
<ul>
<li><strong>Linked representation</strong></li>
</ul>
<p>The most popular way to represent a binary tree is by using links or pointers. Each element is represented by a node. That has exactly two link fields. Let us call these link fields left child and right child. In addition to these two link fields each node has a filed named data. <strong>Example:</strong> <img class="alignnone size-full wp-image-6636" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/541.png" alt="54" width="310" height="194" /> <img class="alignnone wp-image-6637" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/551-460x292.png" alt="55" width="523" height="331" /> &nbsp;</p>
<h3><strong>Binary&nbsp; tree traversal</strong></h3>
<p>There are three common ways to traversal a binary tree :</p>
<ul>
<li>Pre order traversal</li>
<li>in order traversal</li>
<li>Post order traversal</li>
</ul>
<h3><strong>Preorder traversal</strong></h3>
<ul>
<li>Process the root R.</li>
<li>Traverse the left sub tree of R in preorder</li>
<li>Traverse the right sub tree of R in preorder.</li>
</ul>
<p>&nbsp; &nbsp;</p>
<h3><strong>In order Traverse</strong></h3>
<ul>
<li>Traverse the left sub tree or R in in order</li>
<li>Process the left R</li>
<li>Traverse the right sub tree R in in order.</li>
</ul>
<h3><strong>Post order Traversal</strong></h3>
<ul>
<li>Traverse the left sub tree of R in post order</li>
<li>Traverse the right sub tree of R in post order</li>
<li>Process the Root R.</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-6638" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/561-460x493.png" alt="56" width="443" height="476" /> <img class="alignnone wp-image-6639" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/571-460x180.png" alt="57" width="446" height="174" /> &nbsp; <strong>Algorithm</strong><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong> <strong>Preorder traversal</strong> void preorder(Binary Tree Node*t) { // preorder traversal if(t) { printf(&ldquo;%d&rdquo;,t- &gt;data);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // visit tree root preorder(t-&gt; leftchild);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // do left sub tree preorder(t-&gt; right child);&nbsp; // do right sub tree } } &nbsp; <strong>Algorithm</strong> <strong>In order traversal </strong> void inorder (Binary TreeNode&nbsp;&nbsp; *t) { // Inorder traversal if(t) { inorder(c-&gt; leftchild);&nbsp; // do left subtree printf(&ldquo;%d&rdquo;,t-&gt; data);&nbsp; // visit tree root inorder(t-&gt; right child); // do right sub tree } } &nbsp; <strong>Algorithm</strong> <strong>Post order traversal</strong> void post order(Binary Tree Node *t) { if(t) { past order(t-&gt; left child);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // do left sub tree past order(t-&gt; right child); // do right sub tree printf(&ldquo;%d&rdquo;,t-&gt; data); // visit tree root } }</p>25:T1236,<h3><strong>Binary search tree</strong></h3>
<p><strong>&nbsp;</strong> A binary search tree is a binary tree that may be empty A no-empty binary search tree in data structures satisfy the following properties :</p>
<ul>
<li>Every element has a key(or value), and no two elements have the same key; Therefore, all keys are distinct.</li>
<li>The keys(if any) is the left subtree of the root are smaller than the key in the root.</li>
<li>The keys(if any) in the right sub tree of the root are larger than the key in the root.</li>
<li>The left and right sub trees at the root are also binary search trees.</li>
</ul>
<p><img class="alignnone wp-image-6642" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/581-460x310.png" alt="58" width="541" height="364" /> &nbsp; &nbsp; <strong>Searching BST</strong><strong> :</strong></p>
<ul>
<li>If we are searching for 15, Then we are done</li>
<li>If we are searching a key&lt;15, Then we should search in the left sub tree</li>
<li>If we are searching for a key &gt; 15, then we should search in the right sub tree</li>
</ul>
<p>&nbsp; <img class="alignnone size-full wp-image-6643" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/591.png" alt="59" width="300" height="326" /> &nbsp; &nbsp; &nbsp;</p>
<h3><strong>Search for 9:</strong></h3>
<ol>
<li>compare 9: 15(The root), goto left sub tree;</li>
<li>Compare 9: 6,go to right sub tree.</li>
<li>compare 9: 7, go to right sub tee</li>
<li>compare 9: 9, found it</li>
</ol>
<p>&nbsp;</p>
<h2><strong>Insertion operation</strong></h2>
<p><strong>Algorithm:</strong></p>
<ol>
<li>perform search for value x</li>
<li>search will end at node y(if x not in tree)</li>
<li>if x&lt;y, insert new leaf x as new left sub tree for y</li>
<li>if x&gt;y, insert new leaf x as new right sub tree for y.</li>
</ol>
<p>&nbsp; <strong>observations :</strong></p>
<ul>
<li>0(long(n)) operation for balanced tree</li>
<li>Insertion may unbalance tree.</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-6644" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/472.png" alt="47" width="432" height="276" /> &nbsp; 10&lt;20. right 30&gt;20, left 25&gt;20, left insert 20 on left <strong>Example :</strong> instruct a binary search tree with the following elements. 12,5,18,2,9,15,19,13,17 And traverse the binary search tree in z<sub>n </sub>order, preorder, post order &nbsp; <img class="alignnone size-full wp-image-6645" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/601.png" alt="60" width="293" height="174" /> &nbsp; &nbsp; &nbsp; Preorder : 12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 529&nbsp;&nbsp; 1815131719 In order: 259&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12&nbsp;&nbsp;&nbsp;&nbsp; 1315171819 Post order:295&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 131715191812 &nbsp;</p>
<h3><strong>Deletion operation</strong><strong> :</strong></h3>
<p>For element removal we consider the three possibilities for the node P that contains the element to be removed. &nbsp;</p>
<ul>
<li>P is a leaf</li>
<li>P has exactly one nonempty sub tree</li>
<li>P has exactly two non empty sub tree</li>
</ul>
<p><strong>Case 1:</strong> <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong>First cape is handled by discarding the&nbsp; root, The root is set to null. <img class="alignnone wp-image-6646" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/613-460x223.png" alt="61" width="439" height="212" /> <strong>Case 2: </strong> Next consider the case when the element to be removed is in ia node P that has only one non empty sub tree. IF P has no parent (i.e it is root), The root of its single sub tree becomes the new search tree root. IF p has a parent pp, then we change the pointer from PP so that it points to p&rsquo;s only child. ex : Delete 5 <img class="alignnone wp-image-6647" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/621-460x169.png" alt="62" width="540" height="198" /> &nbsp; <strong>Case 3: </strong> Finally, to remove an element in a node that has two no empty sub trees, we replace this element with either the largest element in its left sub tree or the smallest element in its right sub tree. Following this replacement, the replacing element is removed from its original node Ex : Deleting 50 &nbsp; <img class="alignnone wp-image-6648" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/631-460x215.png" alt="63" width="424" height="198" /> &nbsp; &nbsp; &nbsp; &nbsp;</p>26:T1b71,<h2>AVL Trees</h2>
<p>One of the more popular balanced trees, known as an AVL tree in Data Structures, was introduced in 1962 by Adelson-Velski and Landis</p>
<h4><strong>Definition:</strong></h4>
<p>An empty binary search tree is an AVL tree. If T is a non empty binary search tree with T<sub>2 </sub>and T<sub>R</sub> as its left and right sub trees, The T is an AVL tree iff.</p>
<ul>
<li>T<sub>2 </sub>and T<sub>R </sub>are AVL trees and</li>
<li>| h<sub>L &ndash; </sub>h<sub>R </sub>| &lt; =1 where h<sub>L </sub>and h<sub>R</sub> are the heights of T<sub>L</sub> and T<sub> respectively</sub></li>
</ul>
<p><sub>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Or</sub> An Avl trees is a binary search tree in which for every node in the tree, The height of the left and right Sub trees differ by at most1. <img class="alignnone size-full wp-image-6651" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/641.png" alt="64" width="273" height="283" /> &nbsp; &nbsp; h<sub>L</sub> &ndash; h<sub>R</sub> =1 This is AVL Tree &nbsp; <img class="alignnone size-full wp-image-6652" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/651.png" alt="65" width="262" height="290" /> &nbsp; &nbsp; h<sub>L</sub> &ndash; h<sub>R</sub> =2 This is not AVL Tree <img class="alignnone size-full wp-image-6653" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/661.png" alt="66" width="288" height="284" /> &nbsp; &nbsp; &nbsp; This is also a AVL tree hL = Height of left sub tree =2 |hl &ndash; hR |=|2-3|=|- 1|=1 | hL &ndash;hR| &lt;=1 &nbsp; &nbsp; The difference between heights at left sub tree and right sub tree is called balancing Factor of a node. &nbsp; <strong>Importance of Rotations</strong><strong> :</strong></p>
<ul>
<li>The insert and delete operations of AVL tree are the same as binary search tree (BST)</li>
<li>Since an insertion(deletion) involve adding (deleting) a tree node, this can only increase (decrease) the heights of same sub tree(s) by 1</li>
<li>Thus, the AVL tree property may be violated</li>
<li>If the AVL tree property is violated ata node x, it means that the height of left(x) and right(x) differ by exactly 2</li>
<li>After the insertion or deletion operations, we need to examine the tree and see if any node violates the AVL tree property</li>
<li>If the AVL tree property is violated at node so, single or double rotation will be applied to x to restore the AVL tree property.</li>
<li>Rotation will be applied in a bottom up manner starting at the place of insertion(deletion)</li>
<li>Thus when we perform a rotation at x, The AVL tree property is restored at all proper descendants of x.</li>
</ul>
<p>This fact is important. &nbsp; <strong>Single Rotations</strong><strong> :</strong> <strong>RR rotation :-</strong> [ Right &ndash; Right Rotation] <img class="alignnone wp-image-6655" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/671-460x433.png" alt="67" width="471" height="443" /> <img class="alignnone wp-image-6656" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/681-460x480.png" alt="68" width="442" height="462" /> &nbsp; <img class="alignnone wp-image-6657" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/691-460x196.png" alt="69" width="497" height="210" /> &nbsp; &nbsp;</p>
<h3>&nbsp;<strong>Double Rotations :</strong></h3>
<p><img class="alignnone wp-image-6658" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/701-460x210.png" alt="70" width="401" height="182" /> &nbsp;</p>
<h3><strong>LR Rotaion&nbsp; c Left Right Rotation :</strong></h3>
<p>&nbsp; <img class="alignnone wp-image-6659" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/714-460x216.png" alt="71" width="431" height="201" /> &nbsp; &nbsp; <sub>&nbsp; &nbsp;&nbsp;</sub><strong>Ex : Example of RL Rotation : </strong> <img class="alignnone size-full wp-image-6660" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/721.png" alt="72" width="400" height="310" /> &nbsp; &nbsp;</p>
<h3><strong>Ex: Example of LR Rotation:</strong></h3>
<p>&nbsp; <img class="alignnone wp-image-6661" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/722-460x166.png" alt="72" width="506" height="182" /> &nbsp; <strong>Example:</strong> Construct an AVL tree with the following elements 3,2,1,4,5,6,716,15,14 <img class="alignnone size-full wp-image-6662" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/723.png" alt="72" width="419" height="293" /> <img class="alignnone size-full wp-image-6663" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/724.png" alt="72" width="432" height="327" /> <img class="alignnone wp-image-6664" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/725-460x726.png" alt="72" width="501" height="791" /> &nbsp; &nbsp;</p>
<h3><strong>Insertion :</strong></h3>
<ul>
<li>Trace from path of inserted leaf towards the root, and check if the AVL tree property is violated perform rotation if necessary</li>
<li>For insertion, once we perform (Single or doubles) rotation at a node x, The AVL tree property is already restored. We need not to perform any rotation at any ancestor of X.</li>
<li>Thus one rotation is enough to restore the AVL tree properly</li>
<li>There are 4 different cases (actually 2) , so don&rsquo;t mix up them</li>
<li>The time complexity to perform rotation is 0(1)</li>
<li>The time completely to insert, and find a node that violates the AVL property is dependent on the height of the tree, which is 0(log(n))</li>
<li>So insertion takes o(log(n))</li>
</ul>
<p>&nbsp;</p>
<h3><strong>Deletion</strong><strong> :</strong></h3>
<ul>
<li>Delete a node X as in ordinary BST(Note that X is either a leaf or X has exactly one child)</li>
<li>Check and restore the AVL tree property.</li>
<li>Trace from path of deleted node towards the root and check if the AVL tree property is violated</li>
<li>Similar to an insertion operation, there are four cases to restore the AVL tree property.</li>
<li>The only difference from insertion is that after we perform a rotation at x, we may have to perform, a rotation at some ancestors of x, It may involve several rotations.</li>
<li>Therefore, we must continue to trace the path until we reach the root.</li>
<li>The time complexity to delete a node is dependent on the height of the tree, which is also o(log(n))</li>
</ul>
<p>&nbsp;</p>27:T3084,<h2><strong>Circular linked list</strong></h2>
<p>A linked list in which the last node points to the first node instead of containing null pointer will be termed as circularly linked list or simply circular list &nbsp; <img class="alignnone wp-image-6604" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/362-460x113.png" alt="36" width="468" height="114" /> &nbsp; Circular linked list in data structures have an advantages over singly linked list. It is concerned with the accessibility of a node. Ina circular list every node is accessible from a given node that is, from this given node all nodes can be reached by changing through the list. &nbsp;</p>
<h3><strong>Insertion operation:</strong></h3>
<ol>
<li>Insertion as a first node:</li>
</ol>
<p>cur<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> 1= Head; Head=cur; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;1=Head; &nbsp; <img class="alignnone wp-image-6605" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/372-460x232.png" alt="37" width="411" height="207" /> &nbsp; &nbsp;</p>
<h3>(ii) <strong>Insertion after a given node:</strong></h3>
<p>cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link = ptr &agrave; link; ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link =cur; &nbsp; <img class="alignnone wp-image-6606" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/381-460x237.png" alt="38" width="458" height="235" /> &nbsp; &nbsp;</p>
<h2><strong>Deletion Operation</strong></h2>
<ul>
<li>
<h3><strong>Deleting first node</strong></h3>
</li>
</ul>
<p>Head =ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =Head; free(ptr); <img class="alignnone wp-image-6607" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/391.png" alt="39" width="566" height="194" /></p>
<ul>
<li><strong>Deleting a specific node</strong></li>
</ul>
<p>temp=ptrl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link; ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link = ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link &agrave; link free(temp); <img class="alignnone wp-image-6609" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/402.png" alt="40" width="527" height="181" /></p>
<h3><strong>Circular linked list Program&nbsp;in Data Structures</strong></h3>
<p>Implementaton of circular linked list # include &lt;studio.h&gt; #include &lt;conio.h&gt; # define NULL #include&lt;stdlib.h&gt; struct Node { int data; struct Node*link; }; struct node*Head; void create() { int a; struct Node * cur,*ptr; Head=NULL; printf(&ldquo;Enter Data For The Node(-1):&rdquo;); scanf(&ldquo;%d%,&amp;a); while(a!=-1) { cur =(struct Node *) malloc (size of (struct Node)); cur<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />data =a; cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link =NULL; if(Head== NULL) Head==cur; else ptr= cur; printf(&ldquo;Enter Data For Node (-1):&rdquo;); scanf (&ldquo;%d&rdquo;,&amp;a); } ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =Head; } void insert() { int ele; char ch; struct Node*ftr, *ptr,*ptr1,*cur; ptr=Head; ptr1=Head; cur=(struct Node *) malloc (size of (struct Nodes); printf(&ldquo;Enter data:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;cur &agrave;data); cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =NULL; printf(&ldquo;Do you want to insert first(y\n):&rdquo;); flush(stdin); scanf(&ldquo;%c&rdquo;,&amp;ch); if((ch==&rsquo;y&rsquo;) || (ch==&rsquo;y&rsquo;)) { while(ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link!=Head) { ptr=ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link; } cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =Head; Head= cur; ptr &agrave; link =Head; } else { printf(&ldquo;After which element you want to insert:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); do { if( ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />data == ele) { cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link; ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link =cur; } ptr1 = ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link; } while(ptr1!=Head); } } void deletion() { int ele; char ch; struct Node *temp,*ptr,*ptr1; ptr=ptr1=Head; fflush(stdin); printf(&ldquo;Do you want to delete first(y\n):&rdquo;); scanf(&ldquo;%c&rdquo;,&amp;ch); if((ch==&rsquo;y&rsquo;)|| (ch==&rsquo;y&rsquo;)) { while(ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link!=Head) { ptr= ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link; } cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link =Head; Head= cur; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =Head; } else { printf(&ldquo;After which element you want to insert:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); do { if(ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data ==ele) { cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link=ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link; ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link =cur; } ptr1 =ptr1 &agrave;link; } while(ptr1!=Head); } } void deletion() { int ele; char ch; struct Node *temp,*ptr,*ptr1; ptr=ptr1=Head; fflush(stdin); printf(&ldquo;Do you want to delete first (y/n):&rdquo;); scanf(&ldquo;%c&rdquo;,&amp;ch); if((ch==&rsquo;y&rsquo;) || (ch==&rsquo;y&rsquo;)) { while(ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link!=Head) { ptr = ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link; } Head =ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link =Head; free(ptr1); } printf(&ldquo;Which element you want to delete:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); do { if(ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data == ele) { temp=ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link; ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link = ptr1 <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;link <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link; free(temp); break; } else { } while(ptr1!=Head) } } void display() { struct Node * temp; temp=Head; do { printf(&ldquo;%d&rdquo; <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />,temp <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data); temp=temp <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />link; } while(temp!= Head); } } void main() { int op; clrscr(); create(); printf(&ldquo;1.INSERTION \n&rdquo;); printf(&ldquo;2.DELETION&nbsp; \n&rdquo;); printf(&ldquo;3.DISPLAY&nbsp; \n&rdquo;); printf(&ldquo;4.EXIT \n&rdquo;); do { printf(&ldquo;Enter your option:\n&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;op); switch (op) { { case1: insertion (); break; case2: deletion (); break; case3: Display(); break; case4: exit(0); } } while (op&lt;=4); }</p>28:T376a,<h2><strong>Doubly Linked List</strong></h2>
<p>In a single linked list, it is possible to move only in the direction of links, that is we have been restricted to traversing linked list in only one direction. In the linked lists, each node provides information about where is the next node in the list. It has no knowledge about where the previous node lies in memory. If we are at say the 15th node in the list, then to reach the 14<sup>th</sup> node we have to traverse the list right from the first node. To avoid this we can store in each node not only the address of next node but also. The address of the previous node in the linked list this arrangement is often known as &lsquo;Doubly linked list&rsquo; in data structures. The list can be traverse in either a forward or backward direction. Each node in doubly linked list must contain two link fields instead of one. Here a node has at least three fields say data, left link and right link. &nbsp; &nbsp; <img class="alignnone wp-image-6612" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/415-460x266.png" alt="41" width="562" height="324" /> &nbsp;</p>
<h3><strong>Insertion Operation</strong></h3>
<ul>
<li><strong>Insertion of first Node</strong></li>
</ul>
<p>ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=cur; cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl =ptr; rur=cur; <img class="alignnone wp-image-6614" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/422-460x150.png" alt="42" width="482" height="156" /> &nbsp; &nbsp;</p>
<ol>
<li>
<h3><strong>&nbsp;Insertion after a given node:</strong></h3>
</li>
</ol>
<p>cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl =ptr &agrave;fl; cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl =ptr; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=cur; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />fl =cur; <img class="alignnone wp-image-6615" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/403-460x236.png" alt="40" width="422" height="215" /> &nbsp;</p>
<h2><strong>Deletion Operation</strong></h2>
<ol>
<li>
<h3><strong>Deleting First Node</strong></h3>
</li>
</ol>
<p>ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />fl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />bl= ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />bl; root =ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />fl; &nbsp; <img class="alignnone wp-image-6616" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/431-460x116.png" alt="43" width="444" height="111" /> &nbsp;</p>
<ol>
<li>
<h3><strong>Deleting a specified node:</strong></h3>
</li>
</ol>
<p>ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />bl = ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />bl; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />fl= ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />fl; &nbsp; <img class="alignnone wp-image-6617" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/432-460x153.png" alt="43" width="491" height="162" /> &nbsp;</p>
<h3><strong>Program</strong></h3>
<p>Implementation of Doubly linked list #include &lt;stdio.h&gt; #include&lt;conio.h&gt; # include&lt;stdlib.h&gt; struct dlist { int data; struct dlist ,*fl,*bl; }; typedef struct dlist node; node *ptr,*root,*cur,*last; void display() { ptr=root; last=NULL; printf(&ldquo;The list is \n&rdquo;); while(ptr!=NULL) { printf(&ldquo;%d <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&rdquo;,ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />data); if(ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />flNULL); last=ptr; ptr=ptr-fl; } printf(&ldquo;\n reverse list&rdquo;); ptr=last; while(ptr!=Null) { printf(&ldquo;%d <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&rdquo;,ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ptr=ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> bl; } } void insertion() { int ele; char ch; ptr=root; cur=(node *) malloc*(sizeof(nodes)); printf(&ldquo;enter data for node&rdquo; ); scanf(&ldquo;%d&rdquo;, &amp;cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data); cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl=cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=NULL; ffush(stdin); printf(&ldquo;do you want to insert first(Y/N):&rdquo;); scanf(&ldquo;%c&rdquo;,&amp;ch); if(ch==&rsquo;Y&rsquo; || ch==&rsquo;Y&rsquo;) { ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> bl=cur; cur<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> &nbsp;fl=ptr; root=cur; } Else &nbsp; &nbsp; &nbsp; &nbsp; { printf(&ldquo;After which element you want to insert:&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;ele); while(ptr!=NULL) { if(ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> data== ele) { cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl=ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl; cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=ptr; ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=cur; ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl=cur; break; } else ptr=ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl; } void deletion() { int ele; char ch; ptr=root; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fflush(stdin); printf(&ldquo;Do you want to delete first(y/n)&rdquo;); scanf(&ldquo;%c&rdquo;, &amp;ch); if(ch==&rsquo; Y&rsquo;||ch=&rsquo; Y&rsquo;) { ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />bl=ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl; root=ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl; } else { printf(&ldquo;which element you want to delete :&rdquo;); scanf(&ldquo;%d&rdquo;, &amp;ele); while(ptr!=NULL) { if(ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;data==ele) { ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=ptr -<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />bl; ptr <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;fl=ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />fl; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else ptr=ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl; } } } void main() { int a,n; root=NULL; printf(&ldquo;Enter data for node(-1)&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;a); while(a!=-1) { cur=(node*) malloc(sizeof(nodes)); cur-&gt; data =a; cur<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl=cur <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;bl=NULL; if(root==NULL) root=cur; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { cur<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> bl=ptr; ptr<img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" /> fl=cur; } ptr=cur; printf(&ldquo;enter data for node(-1)&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;a); } printf(&ldquo;1.display\n&rdquo;); printf(&ldquo;2.Insertion\n&rdquo;); printf(&ldquo;3. deletion \n&rdquo;); printf(&ldquo;4. Exit \n&rdquo;); do { printf(&ldquo;Enter four option :&rdquo;); scanf(&ldquo;%d&rdquo;,&amp;n); switch(n) { case 1: display();break; case 2: insertion();break; case 3: deletion(); break; case 4: exit(0); break; } } while(n&lt;=4); getch(); }</p>29:T2e4f,<h2><strong>B Trees</strong></h2>
<h3><strong>m-way search trees</strong></h3>
<h4><strong>Definition</strong></h4>
<p>An m-way search tree may be empty if it is not empty it is a tree that satisfies</p>
<h3><strong>The following properties</strong></h3>
<p>In the corresponding extended search Tree, each inter-node has up to in children and between 1 and m-1 elements (External nodes contain no elements and have no children) Every node with p elements has exactly p+1 children Consider any node with p elements. Let k1----kp be the keys of these elements. The elements are ordered so that k1&lt;k2 - -- -- kp. Let c<sub>0</sub>,C<sub>1</sub>&hellip;..C be the p+1 children of the node. The elements in the sub tree with root c<sub>p </sub>have keys larger than k<sub>p </sub>and those in the sub tree with root C; have keys larger than k<sub>i </sub>but smaller than k<sub>i+1,</sub>1&lt;=i&lt;p &nbsp; Ex : A seven way search Tree G -&gt; External nodes &nbsp; <img class="alignnone wp-image-6667" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/731-460x171.png" alt="73" width="565" height="209" /> &nbsp;</p>
<h3><strong>B trees of order m </strong></h3>
<p><strong>Definition </strong> A B-tree in Data Structures&nbsp;at sizzler in is an m-way search tree if the B-tree is not empty, The corresponding extended tree satisfies the following properties The root has at least two children Fill internal nodes other than the root have at least [m/2] children. All external nodes are at the same level. &nbsp;</p>
<h3><strong>Example of B-tree in Data Structures</strong></h3>
<p><img class="alignnone wp-image-6668" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/741-460x143.png" alt="74" width="565" height="175" /> &nbsp; Here m =7 m/2 =7/2 =3.5 =4 figure 2</p>
<h3><strong>Insertion into a B tree </strong></h3>
<p>To insert an element into a B-tree we first search for the presence of an element with the same key. If such an element is found, The insert fails because duplicates are not permitted. When the search is unsuccessful, we attempt to insert the new element into the last internal node encountered on the search path. <strong>Ex: Insert 3into above figure(figure2)</strong> When inserting an element with key 3 into the B-tree of figure,we examine the root and its left child. We fall of the tree at the second external node of the left child, since the left child currently has three elements and can hold up to six, the new element any inserted into this node, the result is the B-tree of figure (3). &nbsp; <img class="alignnone wp-image-6669" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/751-460x128.png" alt="75" width="575" height="159" /> &nbsp; <strong>E.g.:2 Insert 25 into figure3:</strong> This element is to go into the node [20, 30,40, 50, 60,70].However, this node is full when the new element needs to go into a full node, the full node is split. <img class="alignnone wp-image-6670" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/761-460x165.png" alt="76" width="645" height="230" /> &nbsp; &nbsp;</p>
<h3><strong>Deletion from a B tree</strong></h3>
<p>Deletion is first divided into two cases:</p>
<ol>
<li>The element to be deleted is in a node whose children are external nodes (i.e. the element is in a leaf).</li>
<li>The element is to be deleted from a non-leaf case2 is transformed into case(1) by replacing the deleted element with either the largest element in its left neighboring sub tree or the smallest element in its right &ndash;neighboring sub tree. The replacing element is guaranteed to be in a leaf.</li>
</ol>
<p>e.g. Delete 50 from the B tree of figure3 &nbsp; To delete 50 from the&nbsp; B tree of figure 4, we write out the modified node [20, 30, 40, 60, 70 ] &nbsp; <img class="alignnone wp-image-6671" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/771-460x166.png" alt="77" width="564" height="203" /> &nbsp; <strong>E.g.2: Deleting the element with key 80 from the B tree of figure (3)</strong> Since the element is not in a leaf, we find a suitable replacement .The possibilities are the element with key 70 (i.e. the largest element in the left &ndash;neighboring sub tree) and 82 (i.e. the smallest element in the right- neighboring sub tree).When we use the 70, the problem of deleting this elements. <img class="alignnone wp-image-6672" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/781-460x183.png" alt="78" width="582" height="231" /> <strong>E.g.3:</strong><strong> Deleting element 25 from the B-tree of figure4</strong> When the element is being deleted from a non-root node that has exactly the minimum number of elements, we try to replace the deleted element with an element from its nearest left sibling or right sibling. Notice that every node more other than the root has either a nearest left sibling or a nearest right sibling or both. <img class="alignnone wp-image-6673" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/791-460x165.png" alt="79" width="564" height="201" /> &nbsp; <strong>E.g.: Deleting element 25 from B tree of figure 4.</strong> In our example the siblings [20, 30] and [50, 60, 70] and the element with the key 40 are merged into the single node [20, 30, 40, 50, 60, 70].The resulting B-tree is that of figure (8). &nbsp; <img class="alignnone wp-image-6674" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/801-460x171.png" alt="80" width="608" height="225" /> &nbsp; <strong>Example</strong> Construct a B tree of order 3 using the following elements: 78, 52, 81, 40, 33, 90, 85, 20, 38 <strong>Solution</strong> <img class="alignnone wp-image-6676" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/815-460x398.png" alt="81" width="581" height="502" /> &nbsp;</p>
<h2>&nbsp;<strong>Deques</strong></h2>
<ul>
<li>A queue is a linear list in which elements can be added or removed at either end but not in the middle.</li>
<li>The term deque is a contraction of the name double-ended queue.</li>
<li>Such a structure can be represented by the following figure.</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-6677" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/822-460x111.png" alt="82" width="554" height="133" /> &nbsp;</p>
<ul>
<li>There are two variable of deque, namely, the input-restricted deque and output restricted deque.</li>
<li>An input- restricted deque is a deque, which allows insertions at only one end of the list but allows deletion at both ends of the list.</li>
<li>An output &ndash;restricted deque is a deque that allows deletions at only one end of the list but allows insertion at both ends of the list.</li>
<li>A deque is a double &ndash;ended queue. You can insert items at either end and delete then from either end.</li>
<li>If you restrict yourself to addqat beg() and delqatbeg(), then the deque acts like a stack .If you restrict yourself to addqatbeg() and delqatend(),then is acts like a queue.</li>
</ul>
<p>&nbsp;</p>
<h3><strong>Program:</strong> Implementation of deque using arrays</h3>
<p>#include&lt;stdio.h&gt; #include&lt;conio.h&gt; static int deque [max]; int front=-1; int rear=-1; // insert an element from void addqatbeg(int item) { int i; if(front ==0 &amp;&amp;rear == max-1) { printf(&ldquo;\n Deque is full \n&rdquo;); return; } if( front ==-1) { front =rear=0; Deque [front=item; return; } if (rear!=max-1) { int c= count(); int k=rear+1; for(i=1;i&lt;=c; i++) { Deque[k]=Deque[k-1]; k- -; } Deque[k]=item; front=k; rear++; } else { front- -; Deque[front]=item; } } void addqatend(int item) { inti; if(front ==0 &amp;&amp;rear ==MAX-1) { printf(&ldquo;\n Deque is full \n&rdquo;); return; } if(front==-1) { rear=front=0; Deque[rear]=item; return; } if (rear==MAX-1) { int k=front-1; for(i=front-1;i&lt;rear;i++) { k=i; if(k=MAX-1) Deque[k]=0; else Deque[k]=Deque[i+1]; rear - -; front- -; } rear++; Deque[rear]=item; } &nbsp; &nbsp;</p>
<h4>//removes an element from the front end of deque</h4>
<p>int delzatbeg() int item; if(front==-1) { printf(&ldquo;\n Deque is empty \n&rdquo;); return 0; } item =Deque[front]; Deque[front]=0; if (front==rear) front=rear=-1; else front++; return item; } &nbsp;</p>
<h4>//removes an element from the rear end of the deque</h4>
<p>int delqatend() { int item; if(front==-1) { printf(&ldquo;\n Deque is empty\n&rdquo;); return 0; } item=Deque[rear]; Deque[rear]=0; rear- -i; if(rear==-1) front=-1; return item; }</p>
<h4>//display elements of a deque</h4>
<p>void display() { int i; printf(&ldquo;\n front &agrave;&rdquo;); for(i=0;i&lt;MAX; i++) printf(&ldquo;%d&rdquo;,Deque[i]); prinft(&ldquo;&szlig; rear&rdquo;); }</p>
<h4>//count the total number of elements in deque</h4>
<p>int count() { int&nbsp; c=0; int i; for(i=0;i&lt;MAX;i++) { if(Deque[i]!=0)c++; } return c; } void main() { int n,i; addqatend(17); addqatbeg(10); addqatend(8); addqatbeg(-9); addqatend(13); addqatbeg(28); addqatend(14); addqatbeg(5); addqatend(25); addqatbeg(6); addqatend(21); addqatbeg(11); printf(&ldquo;\n Elements in a deque:&rdquo;); display(); n=count(); printf(&ldquo;\n Total number of elements in deque :%d&rdquo;,n); i=delqatbeg(); printf(&ldquo;\n item extracted:%d&rdquo;,i); i=delqatbeg(); printf(&ldquo;\n item extracted:%d&rdquo;,i); i=delqatbeg(); printf (&ldquo;\ item extracted :%d&rdquo;,i); i=delqatbeg(); printf(&ldquo;\n item extracted:%d&rdquo;,i); printf(&ldquo;\n Elements in a Deque after addition:&rdquo;); display(); i=delqatend(); printf(&ldquo;\n item extracted :%d, i); i=delqatend(); printf(&ldquo;/n item extracted:%d&rdquo;,i); printf(&ldquo;\n Elemens ina deque after deletion :&rdquo;); display(); n=count(); printf(&ldquo;\n Total number of elements in deque:%d&rdquo;,n); } <strong>Output</strong> Elements is deque: front <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;6 5 29-9 10 17 8 13 14 25 <img class="alignnone wp-image-6278" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/611.png" alt="6" width="88" height="12" />&nbsp;rear Total number of elements in deque :10 item extracted :6 item extracted :5 item extracted:28 item extracted :-9 &nbsp; &nbsp; Elements in adeque after deletion: front <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />0 0 0 0 10 17 13 14 25 <img class="alignnone wp-image-6278" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/611.png" alt="6" width="88" height="12" />rear Elements in a deque after addition : front <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;o o 10 17 8 13 14 2516 7 <img class="alignnone wp-image-6278" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/611.png" alt="6" width="88" height="12" />&nbsp;rear item extracted :7 item extracted :16 Elements in a deque after deletion: front <img class="alignnone size-full wp-image-6279" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/712.png" alt="7" width="55" height="13" />&nbsp;0 0 10 17 8 13 14 25 0 0 <img class="alignnone wp-image-6278" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/611.png" alt="6" width="88" height="12" />rear Total number of elements in deque: 6 &nbsp;</p>2a:Tbe3,<h2><strong>Trees</strong></h2>
<p>The linear data structures are generally not suitable for the representation of hierarchical data in hierarchal data we have an ancestor ,descendent, superior-subordinate, whole part, or similar relationship among the data elements. Definition : A tree in data structures&nbsp;is a finite set of one or more nodes such that : A distinguish node, called the root. The remaining nodes are partitioned into n&gt;=0 disjoint steps called sub trees of the root Note# that the hierarchical relationship between various data items can be represented by using trees.</p>
<p>&nbsp; <img class="alignnone wp-image-6626" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/461-460x238.png" alt="46" width="432" height="223" /> &nbsp;</p>
<h3><strong>Example</strong></h3>
<p>The inheritance relationship between classes in a form a tree. In most operating systems, files are organized hierarchy calls into nested directories which are presented to the use in the form of a tree. A structured document, such as a book, ie hierarchy organized as a tree where internal nodes are chapters, sections and&nbsp; sub sections, and where external nodes.&nbsp;</p>
<table style="border-collapse: collapse; width: 100.017%; height: 35.0374px; background-color: #ECF0F1;" border="1px" cellpadding="10">
<tbody>
<tr style="height: 35.0374px;">
<td style="width: 98.3494%; height: 35.0374px; text-align: center;">Related Article: <em><strong><span style="color: #236fa1;"><a style="color: #236fa1;" href="https://tekslate.com/stacks-in-datastructures" target="_blank">Stacks in Data Structures</a></span></strong></em></td>
</tr>
</tbody>
</table>
<h3><strong>Basic terminology</strong></h3>
<p>A node stands for the item of information plus the branches to other items, Trees has 13 nodes. The number of sub trees of a node is called its degree. The degree of A is 3, of c is 1 and F is nodes that have degree 0 are called leaf or terminal nodes. The other nodes are called non terminal, nodes. E,F,K,H,I,L,M id set of leaf nodes. A node is external it has no children and it is internal if it has one or more children , external nodes are also known as leafes. The roots of the sub trees of&nbsp; a node are called the children of that node. In the following above figure &lsquo;A&rsquo; is called the parent of B,C and D. The children of D are H,I and J. The parent of D is A. An ancestor of a node is either the node itself an ancestor of the parent of the node. Conversely, we say that a node v is a descendent of a node U if U is an ancestor of V. &nbsp; Children of the same parent are said to be siblings. H,I and J are siblings. The degree of a tree is the maximum degree of the nodes in the tree. The tree of figure has degree 3. Another commonly used tree term is leafs. By definition the tree root is at level 1; its children (if any) are at level2; their children (if any) are at level 3 and so on. The height or depth of tree is defined to the maximum level of any node in the tree.</p>2b:T2219,<h2><strong>Graphs</strong></h2>
<p>A graph in data structures G consists of two things:</p>
<ol>
<li>A set v of elements called nodes (or points or vertices)</li>
<li>A set E of edges such that each edge e in E is identified with a unique (unordered) pair [u,v] of nodes in v, denoted by e=[u,v]sometimes we indicate the parts of a parts of a graph by writing G=(v,E).</li>
</ol>
<h4>Examples:</h4>
<p><img class="alignnone wp-image-6680" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/831-460x219.png" alt="83" width="469" height="222" /> &nbsp; G=(V,E)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; G=(V,E) V={1, 2, 3, 4}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; V={1, 2, 3, 4, 5} E={(1,2);(2,3);(2,4);(3,4);(1,3)}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; E={(1,2) (1,3) (3,2) (3,5) (3,4) (4,2) (5, 4)} Suppose e=[u,v] then the nodes u and v are called the end points of e ,and u and v are said to be adjacent nodes or neighbors. An edge with an orientation is a directed edge while an edge with no orientation is an undirected edge. The undirected edges (i,j) and (j,i) are the same; the directed edge(i,j) is different from the directed edge(j,i). If all the edges in a graph are undirected, then the graph is undirected graph. The graphs of figure(a) and are undirected graphs. If all the edges are directed , then the graph is directed graph. The graph of figure(b) is a directed graph. Often an undirected graph is a simply called a graph and a directed graph is called a digraph. &nbsp; In some applications of graphs and graphs we shall assign a weight or cost to each edge, when weights have been assigned to edges we use the terms weighted graph and weighted digraph. To refer to the resulting data object the term network refers to a weighted graph or digraph. Example: <img class="alignnone wp-image-6681" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/841-460x189.png" alt="84" width="654" height="268" /> &nbsp;</p>
<h3>&nbsp;</h3>
<h3><strong>Representation of graphs and&nbsp; Digraphs in data structures</strong></h3>
<p>The most frequently used representation schemes for graphs and digraphs are adjacently based adjacency matrices and linked adjacency list. &nbsp; &nbsp;</p>
<ol>
<li>
<h3><strong>Adjacency Matrix:</strong></h3>
</li>
</ol>
<p>The adjacency matrix of an n-vertex graph G=(V,E) is an nXn matrix A, each element of A is either zero or one .We shall assume that V={1, 2, 3, . . . . . n}.If G is a graph, then the elements of A are defined as follows. &nbsp; <img class="alignnone wp-image-6682" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/851-460x385.png" alt="85" width="451" height="377" /> &nbsp;</p>
<ol>
<li>
<h3><strong>Linked &ndash;adjacency list:</strong></h3>
</li>
</ol>
<p>In the case of linked adjacency lists, let G be a graph with m nodes.&nbsp; The array representation of G in memory i.e., the representation of G by its adjacency matrix A has a number of major drawbacks. Consider the graph G in figure (a).The table shows each node in G followed by its adjacency list, which it&nbsp; its list of adjacent nodes also called its successors or neighbours.Figure represents a schematic diagram of linked representation of G in memory specifically, the linked representation will contain two lists (or files), a node list NODE and edge list EDGE. &nbsp; &nbsp; <img class="alignnone wp-image-6684" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/862-460x411.png" alt="86" width="536" height="479" /> &nbsp;</p>
<h3><strong>Traversing a Graph:</strong></h3>
<p>Many graph algorithms require one of systematically examine the nodes and edges of graph G. There are two standard ways that this is done one way is called a breadth first search and the other is called a depth- first search. The breadth &ndash; first search will use a queue as an auxiliary structure to hold nodes for future processing and analogously .The depth &ndash;first search will use a stack.</p>
<ol>
<li>
<h4><strong>Breadth &ndash;first traversal : [B F S]</strong></h4>
</li>
</ol>
<p>A data structure queue is used to place all waiting nodes. This queue is also convenient to keep the track of nodes that are already. &nbsp;</p>
<h4><strong>Algorithm:</strong></h4>
<ol>
<li>All nodes are initialized as ready states and initialise queue to empty.</li>
<li>Begin with any node, which is in ready state and put into queue. Mark the status of that node to waiting</li>
<li>While queue is not empty do begin.</li>
<li>Delete the first node k from queue and process it mark the status of that node.</li>
<li>Add all the adjacent nodes of k which are in ready state to the rear side of the queue and mark the status of these nodes to waiting.</li>
<li>If this graph still contains nodes which are in ready which are in ready state then go to step(2)</li>
<li>&nbsp;</li>
</ol>
<p>&nbsp;</p>
<h3><strong>Dept-First search (DFS):</strong></h3>
<p>In the depth &ndash;first search traversal, we back track on a path once it reached the end of the path. We consider the data structure stack instead of a queue as in breadth first search.</p>
<h4><strong>Algorithm: </strong></h4>
<ol>
<li>All nodes are initialized to ready state and initialize stack to empty.</li>
<li>Begin with any node which is in ready state and path into stack mark the status of that node to waiting.</li>
<li>While stack in not empty do begin.</li>
<li>Pop to node of stack and process it mark the status of that node to be visited.</li>
</ol>
<ol start="5">
<li>Push at the adjacent nodes of k which are in ready state into stack and mark the stack of those nodes to waiting.</li>
<li>If the graph still contains nodes which are in ready state then go to step(2).</li>
<li>&nbsp;</li>
</ol>
<p>&nbsp;</p>
<h3><strong>Example for BFS:</strong></h3>
<p><img class="alignnone size-full wp-image-6685" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/881.png" alt="88" width="440" height="355" /></p>
<h3><strong>Adjacency nodes lists:</strong></h3>
<table>
<tbody>
<tr>
<td width="47">1</td>
<td width="101">1,2,4</td>
</tr>
<tr>
<td width="47">2</td>
<td width="101">0,4</td>
</tr>
<tr>
<td width="47">3</td>
<td width="101">0,4,5,9,10</td>
</tr>
<tr>
<td width="47">&nbsp;</td>
<td width="101">&nbsp;</td>
</tr>
<tr>
<td width="47">4</td>
<td width="101">0,1,2</td>
</tr>
<tr>
<td width="47">5</td>
<td width="101">2,6,7,8</td>
</tr>
<tr>
<td width="47">6</td>
<td width="101">5</td>
</tr>
<tr>
<td width="47">7</td>
<td width="101">5,8</td>
</tr>
<tr>
<td width="47">8</td>
<td width="101">5,7</td>
</tr>
<tr>
<td width="47">9</td>
<td width="101">2,11</td>
</tr>
<tr>
<td width="47">10</td>
<td width="101">2,11</td>
</tr>
<tr>
<td width="47">11</td>
<td width="101">9,10</td>
</tr>
</tbody>
</table>
<p>&nbsp; &nbsp;</p>
<h3><strong>&nbsp;After Traversing the BFS graph:</strong></h3>
<p><img class="alignnone wp-image-6686" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/891.png" alt="89" width="266" height="316" /> &nbsp;</p>
<h3><strong>Example for DFS:</strong></h3>
<p>&nbsp; <img class="alignnone size-full wp-image-6687" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/892.png" alt="89" width="343" height="246" /></p>
<table>
<tbody>
<tr>
<td width="147">0</td>
<td width="147">1,2,4</td>
</tr>
<tr>
<td width="147">1</td>
<td width="147">0,4</td>
</tr>
<tr>
<td width="147">2</td>
<td width="147">0,4,5,9,10</td>
</tr>
<tr>
<td width="147">4</td>
<td width="147">0,1,2</td>
</tr>
<tr>
<td width="147">5</td>
<td width="147">2,6,7,8</td>
</tr>
<tr>
<td width="147">6</td>
<td width="147">5</td>
</tr>
<tr>
<td width="147">7</td>
<td width="147">5,8</td>
</tr>
<tr>
<td width="147">8</td>
<td width="147">5,7</td>
</tr>
<tr>
<td width="147">9</td>
<td width="147">2,11</td>
</tr>
<tr>
<td width="147">10</td>
<td width="147">2,11</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h3><strong>After traversing the DFS:</strong></h3>
<p>&nbsp; <img class="alignnone wp-image-6688" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/893.png" alt="89" width="267" height="318" /> &nbsp; &nbsp;</p>2c:T5ed6,<p>To design JSF application we have to use the following elements User interface[View] Web.xml file[Deployment Descriptor] Faces servlet Managed Bean[model1] Facesconfig.xml[Faces configuration file] <strong>&nbsp;</strong> <img class="alignnone wp-image-9973" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_739-460x124.png" alt="Screenshot_7" width="484" height="129" /> &nbsp; <strong>Loginfrom.jsp</strong> &lt;%@taglib usre= &ldquo;http://Java.sun.com/JSF/Core&rdquo; prefix=&rdquo;f&rdquo;%core tag library &lt;%@taglib usre= &ldquo;http://Java.sun.com/JSF/ http&rdquo;prefix=&rdquo;h&rdquo;%&gt; &lt;f:view id=&rdquo;loginview&rdquo;&gt; &lt;html&gt; &lt;body&gt; &lt;h:form&gt; &lt;h:panel Grid columns=&rdquo;2&rdquo;&gt; &lt;h:output text value=&rdquo;user name&rdquo;/&gt; &lt;h: input text id=&rdquo;u name&rdquo; value =&rdquo;#. property name u name log cal name&rdquo;/&gt; &lt;h:output text value=&rdquo;password&rdquo;/&gt; &lt;h: input secrete id=&rdquo;upwd&rdquo; value=#{log in bean. upwd}&rdquo;/&gt; &lt;h: command button value=&rdquo;Log in&rdquo; action=&rdquo;#{log in bean, check log in}&rdquo;/&gt; &lt;/h:panel Grid&gt; &lt;/h:from&gt; &lt;/body &gt; &lt;/html&gt; &lt;/fi view&gt; &nbsp; <strong>1 -</strong> When we click on a button in JSF enabled web page, automatically, action event will be raised, to handle this action event, event handler will, send a request to server <strong>2 -</strong> Server will take the request and identify the target resource through web.xml file, in JSF for every request the target resource is faces servlet. <strong>3 - </strong>From url pattern (dss) it indicate faces servlet <strong>4 -</strong> After getting faces servlet is the target resource through web.xml file, container will&nbsp; execute faces servlet provided service oriented methods. <strong>5 -</strong> upon receiving request from client, faces servlet has to identify the name and location of managed bean component in order to instantiate, for this, faces servlet will go to bases- config.xml file. <strong>6 - </strong>After getting the respective managed bean component name and location faces servlet will identify it and it will perform managed bean loading, instantiation and data population[getting request parameter values from request object and storing in managed] <strong>7 -</strong> After managed bean instantiation, faces servlet will identify business method from action event and faces servlet will execute that business method <strong>8 - </strong>By executing B.method in managed bean, faces servlet is able to get the status value in the form at a strong <strong>9 -</strong> Faces servlet has to forward request to a particular JSP page after performing an action in managed bean to identify the target JSP page to forward request, faces servlet will go to faces config.xml file <strong>10 -</strong> After getting the target JSP page url from faces config .xml file, faces servlet forward request to target JSP page <strong>11 -</strong>After executing the target JSP page, container will dispatch the generated dynamic response to client. &nbsp; <strong>User Interface</strong> * The main purpose of user interface in web application is, To improve look and feel the web application To set data from user in order to execute web applications To perform data validations with java script functions To specify different types of requests like GET, POST, Head,&hellip;. In general web applications, we will use the technologies, like html, JSP, velocity, free market to prepare user inter face. In case of JSF based web applications, it is not suggestible to use html, tags directly, always it is suggestible to use JSF provided tag library JSF has provided the complete tag library implementation in the form of a jar file i.e-&ldquo;JSF-api.jar&rdquo;. If we want to use JSP provided tag library in web application then we have to keep JSF-api. Jar file in web app n lib folder If we want to use JSF tags in JSP tags in JSP page than we have use the following tag lib directives %@taglib =&rdquo;http://Java.sun.com/JSP/html&rdquo;prefix=&rdquo;h&rdquo;% &nbsp; <strong>Loginform.JSP</strong> %@TAGLIB url=&rdquo;http://java.sun.com/jst/core&rdquo;prefix=&rdquo;f&rdquo;% /html &rdquo;prefix=&rdquo;h&rdquo;%&gt; &lt;f:view&gt; &lt;html&gt; &lt;body&gt; &lt;h:form&gt; &lt;h:panel Grid column=&rdquo;2&rdquo;&gt; &lt;h:out put test value=&rdquo;username&rdquo;/&gt; &lt;h:in put text id=&rdquo;u name&rdquo; value=&rdquo;#{login bean u name}&rdquo;/&gt; &lt;h:out put test value=&rdquo;password&rdquo;/&gt; &lt;h:in put secrete id=&rdquo;u pwd&rdquo; value=&rdquo;#{login bean, login }&rdquo;/&gt; &lt;h:panel Grid&gt; &nbsp; <strong>&lt;f:view&gt;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /></strong>&nbsp;it will represent a JSF view <strong>&lt;h:panel grid&gt;</strong>&nbsp;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />it will represent a grid layout to arrange all the JSF Components. <strong>&lt;h: form&gt;</strong>&nbsp;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />It is same html&lt;form&gt; tag to represent an unit of GUI Components <strong>&lt;h:outputtext&gt;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /></strong>it will represent a label specified along with &rdquo;value&rdquo; attribute. <strong>&lt;h: input text&gt;</strong>&nbsp;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />it will represent a text field, where &ldquo;id&rdquo; attribute will take component identify to manage components states in component tree where &rdquo;value&rdquo; attribute. Will take an expression to represent a particular property in the respective managed bean&nbsp; to store the value <strong>&lt;h:input secrete&gt;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /></strong>&nbsp;It will represent a password field to enter secrete data like passwords, in number where id attribute will take compo not identify to represent a particular property declare d in the respective managed bean in order to store its value, <strong>&lt;h:command buttons&gt;</strong>&nbsp;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> it will represent a button to rise action event. Where &rdquo;value&rdquo; attribute will take button label. Where &rdquo;action&rdquo; attribute will represent action event and it able to specify the respective b method at managed bean in order to execute upon button click. <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Request url:- http://local host:-/app1/log in form &nbsp; <strong>Web xml&nbsp;</strong> &lt;web-app&gt; &lt;servlet&gt; &lt; servlet&nbsp; name faces servile&lt;/servlet name&gt; &lt; servlet .class&gt;javax.faces. web app. Faces servlet&lt;/servlet class&gt; &lt;load-on-startup&gt;1&lt;/load-on-start up&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;faces servlet &lt;/servle -name&gt; &lt;/servle -mapping&gt; &lt;/web-app&gt; &nbsp; <strong>Deployment Description</strong> Deployment description is web.xml file, it will provide meta data or description about our web application required by the container in order to identify and execute server side resources In general, in web application web.xml file can be used to provide the following configuration details Welcome files configuration Display name configuration Context parameter configuration Servlet configuration Filters configuration Listeners configuration Load on startup configuration Session timeout configuration Initialization parameters configuration Error pages configuration Tag library configuration Security configuration &nbsp; In JSF based web application , web.xml file has to include faces servlet configuration. <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Faces servlet is JSF Provided serviette, it is acting as controller in JSF based web application, to activate this controller we must request faces servlet cfg in web.xml file &nbsp; <strong>Example</strong> &lt;Web app&gt; &lt;servlet&gt; &lt; servlet -name&gt;faces servlet&lt;1servket bane&gt; &lt; servlet -class&gt;Javax. faces .web app .faces servlet &lt;/servlet-class&gt; &lt;load- on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet &gt; &lt;/servlet-mapping &gt; &lt;/servlet-name &gt;faces servlet&lt;/ servlet-name&gt; &lt;url-pattern&gt;*.dss&lt;/url-pattern&gt; &lt;\servlet-mapping&gt; &lt;\web-app&gt; In the above faces servlet configuration, the main requirement of&lt;load-on-startup&gt;configuration is to perform faces servlet loading, instantiation and initialization at the time of servers startup As part of faces servlet initialization, the complete JSF Configurations will be loaded, with this, JSF F/W Will ready at the time of server start up. In general, in web.xml file, we are able to define url patterns fore the servlet in the following 3 approaches</p>
<p style="padding-left: 30px;">Exact match method[/pattern-name]</p>
<p style="padding-left: 30px;">Directory match method[/prefix-name/*]</p>
<p style="padding-left: 30px;">Extension match method[*.extension]</p>
<p>For the faces servlet configuration, we are able to define and pattern either by using director match method or by using extension match method *Possible url patterns fore faces servlet are /faces/*,*,JSF,*Faces,*, only- ext[user defied] &nbsp; <img class="alignnone wp-image-9975" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_924-460x403.png" alt="Screenshot_9" width="515" height="450" /> &nbsp; <strong>Faces servlet</strong> In general in MVC based web appl? The mole of the controller is Pick of the request from client Identify model component Perform model component loading instantiation data population Access application logic Identify target view page Forward request to target view page JSF is MVC based web application f/w, it has provided javax.feices webapp faces serve let as. Controller JSF frame work has provided faces servlet as an implementation class to javax. Servlet. Servlet inter face In JSF, FACE SERVLET has provided the implementation for the following methods from servlet interface public void init (servlet config config)throws servlet exception public void service(servlet request , servlet response ) throws servlet exception, ID exception public servlet config get servlet config get() public String Get Servlet Into() public void destroy() &nbsp; When we start the server the main job of the container is to recognize each and every web application and it will prepare a separate servlet context object for each and every web app. While recognizing web app container will identify web.xml file then container perform web.xml file loading. Parsing and reading the content. If any application level data is identified then container will sore that data in servlet context objects while reading web.xml file content, it container identify &ldquo;load on startup&rdquo; configuration under any servlet then containers will perform that servlet loading instantiation and initialization at the time at servlet start up only In JSF based web application, containers will identify startup configuration under faces servlet configuration with this will search for javax faces web app. Faces servlet class file under classes folder if it is not available then container will search for it&nbsp; all this jar files provided in &ldquo;lib&rdquo; folder In the above context container will identify faces servlet under JSF- ape.jar file then container perform face servlet loading instantiation and initialization at the time of server stat up In faces servlet initialization faces servlet will recognize faces config xml file under WEB-INF folder then faces servlet will perform faces &ndash; config .xml file loading parsing After faces- config.xml file parsing .faces servlet will prepare &ldquo;lifecycle&rdquo; object After the server startup we have to access a page at client browser, we have to provide data in respective fields and we have to submit request from client browser. To server or any hyperlink or by selecting check boxes or radio buttons. Etc When request is submitted to server container will identify the requested resource is faces servlet through web.xml file and container will execute service method of faces servlet When container bypass request to faces servlet, faces servlet will remark a separate object with the present request called as &ldquo;faces context&rdquo; object to store the data which is associated with current request. After preparing &rdquo;faces context&rdquo; object container will invoke life cycle object where lifecycle object will process the request by following &rdquo;JSF Request processing lifecycle&rdquo;</p>
<p style="padding-left: 30px;">Restore view</p>
<p style="padding-left: 30px;">Apply request values</p>
<p>Process validates</p>
<p style="padding-left: 30px;">Update model</p>
<p style="padding-left: 30px;">Invoke application</p>
<p style="padding-left: 30px;">Render response</p>
<p>&nbsp; <strong>Restore view</strong> This phase will check whether the current request is fore any resource or action. If the current request is for any resource then faces servlet will identify the requested resource and by pass the flow of execution directly or render response phase If the present request is for any particular action then faces servlet will perform the following actions Faces servlet will check any &rdquo;component free&rdquo; is existed the present request or not, if any component free is existed then faces servlet will retrieve it It&nbsp; no component tree is existed w.r.to the present request then Faces servlet has to create new component tree. While preparing component tree Faces servlet will perform the following action Faces servlet will create a root node for &lt;f:view&gt; tag in component tree and child nodes for each and every JSF component Which are available in the respective page Faces servlet will store view id value in &ldquo;UIVIEW ROOT&rdquo; Object which is compiling along with request. Faces servlet will store all the&nbsp; incoming &rdquo;locate&rdquo; provided by client browser in &ldquo;UIVIEW ROOT&rdquo; node. if any Validator are configured for UI Components in page then faces servlet will register all the Validator to the components in component tree. If any converters are configured for UI Component in page then faces servlet will register all the converters to the&nbsp;components in component tree. It any listeners are configured fore UI Components in page then faces servlet will register all the listeners to component in component tree. Faces servlet will identify respective model component or Bean component w.r.to the present request through Faces- config.xml file and perform bean loading and instantiation at the time of bean instantiation default values or any initial values will be stored in bean properties these initial values will be set to the respective components in component tree. After preparing component tree, Faces servlet will store other component tree in faces context object and Http Session Object &nbsp; <strong>Apply Request values</strong> In this phase faces servlet will take request parameter values from request object and it will set request parameter values to the corresponding components in component tree To set request parameter values to component tree the following method from UI view root:- Public void process Decode() &nbsp; <strong>Process Validator</strong> In this phase, faces servlet will perform the following actions: Faces servlet will search fore registered Validator at each and every component in component tree If any Validator is identified at component then faces servlet will execute all the Validator It any validation error messages are available then it will add validation error messages to &ldquo;Faces context&rdquo; object. faces servlet will search for the registered convectors at each and every component in component tree It any convertor is identified then faces servlet will execute that convertors If any conversion errors are identified then faces servlet will check any error message is available in faces context object, It any error message is identified then faces servlet will bypass request to &ldquo;Render Response&rdquo; phase directly It no error message is identified in faces context object then faces servlet will bypass request to the next phase id &ldquo;update model&rdquo; To perform process Validator phase, faces servlet will execute the following method from UI view root class Public void process Validator() &nbsp; <strong>Update model</strong> In apply request values phase, all the request parameter values we were set to the components which are available in component tree In this process Validator phase, we have checked weather the data is valid or not After the data validations and conversions the data which is available in component tree is true data, which we have to use in application logic. To use this data in application logic, first we have to set this data to the properties of model component Update model phase will set trustable data from component tree to the model properties. To perform this phase, faces servlet will execute the following method. Public void process updates() &nbsp; <strong>Invoke Application</strong> In this phase, faces servlet will perform the following actions. a) Faces servlet will get the registered method name from the components like button, hyperlink, check box, radio button,&hellip;from component tree. b) Faces servlet will execute the respective method in the respective managed bean component. c) If no return value is identified from managed bean component method then faces servlet will bypass request to &ldquo;Render Response&rdquo; phase to maintain the same page at client browser. d) It any return value is identified from the respective managed Bean component method then faces servlet will identify the target view page from faces &ndash; config. Xml file and by pass request to &ldquo;Render Response&rdquo; phase to generate response To perform this phase, faces servlet will execute the following method Public void process application() &nbsp; <strong>Render Response phase&nbsp;</strong> In this phase, Faces servlet will convert the respective component tree into the equivalent html or xml or wml and etc formations in order to send response to client browser in html or xml or WML,&hellip;formats It the request is coming from &ldquo;Restore View&rdquo; phase then render response phase will send the requested resource as response to client. If the request is coming from &ldquo;Process Validator&rdquo; phase then render response phase will get all the validation and conversion error messages from &ldquo;Faces context&rdquo; Object and send the same page as response to client by embedding error messages. It the request is coming from invoke application phase then render response phase will send the result page as response to client. To perform this phase, faces servlet will execute &nbsp; <strong>Model Component</strong> In MVC based web applications, the main purpose at model component is, To manage application B. logic To manage users from data in order to perform data validations and conversions, To manage users from data in order to perform the database operations like insert, update, retrieve,&hellip;. To transferee the data from controller layer to view later. In JSF web applications, Managed bean component is acting as model To prepare managed bean component in JSF based web applications, we have to use the following guide lines In JSF, Managed bean component should be a POJO class, it should not be extended or implemented from any predefined library. In JSF based applications, Managed bean class must be public, non abstract and no final All the properties in managed bean class must match the properties name which we defined along with UI Components in user forms We must provide set..()methods and getter..() methods for each and every bean property We have to declare business methods which are registered with the GUI Components like buttons, hyperlinks,&hellip; If we want to provide any construction in managed Bean class then that construct fore must be &ldquo;Public&rdquo; and &ldquo;O-argument&rdquo;. Define application logic by declaring business methods &nbsp; <strong>Example</strong> Public class Login bean { Private string u name; Private string u pwd; Public void set u name(string u name) { This. U name = u name; } Public void set upwd(String upwd) { This. Upwd= upwd; } Public string get u name() { Return u name; } Public string get u pwd() { Return u pwd; } Public string log in() { --- logx--- Return &ldquo;Success&rdquo;; } } &nbsp; <strong>Faces configuration File</strong> The main purpose of&nbsp; faces configuration file is to provide the following con fig&nbsp; details request red by faces servlet. Bean component configuration Navigation Rules Validators Convertors Listeners Local configuration. The default name and location of faces configuration file is &ldquo;Faces config.xml&rdquo; file under WEB.INF folder In JSF based web application, it is possible to change the name and location of faces configuration file but we have to configure that name and location under web. In the form of a context parameter Here context parameter name is fixed is Javax. faces. CONFIG &ndash;FILE &lt;Web - app&gt; &lt;Context. parm&gt; &lt;Param.name&gt;Javax. faces. CONFIG.FILE&lt;/paran-bane&gt; &lt;Param. Value&gt;/WEB- INF/classes /my config.xml &lt;Context param ---- &lt;\web.app&gt; In basic JSF application, we need only bean configuration and navigation configurations in faces configuration file <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />faces-config&gt; ----- &lt;managed- bean&gt; &lt;managed- bean-name&gt; bean logical name&lt;/managed-bean- name&gt; &lt;managed- bean-class&gt; bean fully qualified name&nbsp; &lt;/managed-bean- class &gt; &lt;managed- bean-score&gt;session/application &lt;/managed-bean- scope &gt; &lt;/managed-bean &gt; &lt;navigation mull&gt; &lt;from-view-id&gt;/form page&lt;/from-view-id&gt; &lt;navigation &ndash; case&gt; &lt;from- out come&gt; return value from bean method&lt;/from &ndash; out come&gt; &lt;to- view- id&gt;/ to page &lt;/to-view. id&gt; &lt;\navigation-case&gt; --- &lt;\navigation-mule&gt; --- &lt;/faces-config&gt; &nbsp; <strong>Faces- config.xml</strong> ------------------------ &lt;faces-config&gt; &lt;managed-bean&gt; &lt;managed-bean-name&gt;log in bean&lt;/managed-bean-name&gt; &lt;managed-bean-class&gt;com. dss. Log in bean&lt;/managed-bean- class &gt; &lt;managed-bean-scope&gt;session&lt;/managed-bean- scope &gt; &lt;managed-bean&gt; &lt;Navigation. mule&gt; &lt;from-view-id&gt;/login from.jsp&lt;/ from-view-id &gt; &lt;Navigation-case&gt; &lt;from-outcome&gt;success&lt;/ from- outcome &gt; &lt;to-view-id&gt;/success.jsp&lt;/ to-view-id &gt; &lt;/navigation-case&gt; &lt;navigation-case&gt; &lt;from-outcome&gt;failure&lt;/ from- outcome &gt; &lt;to-view-id&gt;/failure.jsp&lt;/ to-view-id &gt; &lt;/navigation-case&gt; &lt;/navigation-mule&gt; &lt;/faces- config&gt;</p>2d:T1e41,<p style="text-align: justify;"><span style="color: #993300;"><strong>What is JSF (JavaServer Faces)?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">It is a server side segment based UI structure. It is used to create web applications. It gives a very much characterized programming model and comprises of rich API and applications. The latest version JSF 2 uses Facelets as its default templating system.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>How does execution phase work in JSF (JavaServer Faces) lifecyle?</strong></span></p>
<p style="text-align: justify; padding-left: 30px;">In execute phase, when first request is made, application view is built or restored. For other subsequent requests other actions are performed like request parameter values are applied, conversions and validations are performed for component values, managed beans are updated with component values and application logic is invoked.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>What is Render Kit in JSF?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">Segment classes for the most part exchange the undertaking of producing yield to the renderer. All JSF parts tail it. Render pack is an arrangement of related renderers. javax.faces.render.RenderKit is the class which speaks to the render pack. The default render pack contains renderers for html however it&acirc;&euro;&trade;s up to you to make it for other markup dialects. Render unit can execute a skin (a look and feel). Render unit can focus on a particular gadget like telephone, PC or markup dialect like HTML, WML, SVG. This is extraordinary compared to other advantage of JSF in light of the fact that JSF doesn't utmost to any gadget or markup.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>How to make custom tag in JSF?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">JSF custom label illustration:</p>
<p style="padding-left: 30px; text-align: justify;">JSF gives the office to make custom tag to render a pre-characterized content. A JSF custom label utilizes "ui:composition" to embed content into the page.</p>
<p style="padding-left: 30px; text-align: justify;">Steps to create the JSF custom tag:</p>
<p style="padding-left: 30px; text-align: justify;">1. In the first place make a predefined content in a XHTML page with ui:compisition tag.</p>
<p style="padding-left: 30px; text-align: justify;">2. Announces and characterize the custom label subtle elements in a label library descriptor.</p>
<p style="padding-left: 30px; text-align: justify;">3. Enlist the label library descriptor in the web.xml document.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>What are different JSF validator tags?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">JSF validator tags:</p>
<p style="padding-left: 30px; text-align: justify;">JSF provides inbuilt validators to validate the UI component data. JSF validators can validates length, type, format etc.</p>
<p style="padding-left: 30px; text-align: justify;">For using JSF validator tags we have to use the following namespaces of URI in html node.</p>
<p style="padding-left: 30px; text-align: justify;">&lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>What is supporting bean?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">JSF backing bean is an overseen bean which contains a few or all estimations of a web frame. It is ordinarily for business rationale.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong id="What_is_JavaServer_Faces_validation_model">What is JavaServer Faces validation model?&nbsp;</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">A mechanism for validating the data a user inputs to a JavaServer Faces UI component.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong id="What_is_JavaServer_Faces_navigation_model">What is JavaServer Faces navigation model?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">A mechanism for defining the sequence in which pages in a JavaServer Faces application are displayed.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong id="What_is_JavaServer_Faces_conversion_model">What is JavaServer Faces conversion model?&nbsp;</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">A mechanism for converting between string-based markup generated by JavaServer Faces UI components and server-side Java objects.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>What are contrasts amongst swaggers and JSF? </strong></span></p>
<p style="padding-left: 30px; text-align: justify;">In a nutshell, Faces has the following advantages over Struts:</p>
<p style="padding-left: 30px; text-align: justify;">Disposed of the requirement for a Form Bean</p>
<p style="padding-left: 30px; text-align: justify;">Disposed of the requirement for a DTO Class</p>
<p style="padding-left: 30px; text-align: justify;">Permits the utilization of the same POJO on all Tiers as a result of the Backing Bean</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>What regular JSF application comprises of?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">A regular JSF application comprises of the accompanying parts:</p>
<p style="padding-left: 30px; text-align: justify;">-JavaBeans segments for overseeing application state and conduct.</p>
<p style="padding-left: 30px; text-align: justify;">-Occasion driven improvement (through audience members as in customary GUI advancement).</p>
<p style="padding-left: 30px; text-align: justify;">-Pages that speak to MVC-style sees; pages reference see roots by means of the JSF part tree.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>What if no navigation rule matches a given action?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;">If no navigation rule matches a given action, then the current page is redisplayed.</p>
<p style="text-align: justify;"><span style="color: #993300;"><strong>Explain life-cycle Phases of JSF?</strong></span></p>
<p style="padding-left: 30px; text-align: justify;"><strong>Restore View</strong> : A request comes through the FacesServlet controller. The controller examines the request and extracts the view ID, which is determined by the name of the JSP page.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Apply request values</strong>: The purpose of the apply request values phase is for each component to retrieve its current state. The components must first be retrieved or created from the FacesContext object, followed by their values.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Process validations</strong>: In this phase, each component will have its values validated against the application's validation rules.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Update model values</strong>: In this phase JSF updates the actual values of the server-side model ,by updating the properties of your backing beans.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Invoke application</strong>: In this phase the JSF controller invokes the application to handle Form submissions.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Render response</strong>: In this phase JSF displays the view with all of its components in their current state.</p>
<hr />2e:T59fe,<h2 class="norm"><span style="color: #000000;">Java Virtual Machine Introduction</span></h2>
<p class="norm">The Java Virtual Machine is the cornerstone of the Java platform. It is the component of the technology responsible for its hardware- and operating system-independence, the small size of its compiled code, and its ability to protect users from malicious programs.</p>
<p class="norm">The Java Virtual Machine is an abstract computing machine. Like a real computing machine, it has an instruction set and manipulates various memory areas at run time. It is reasonably common to implement a programming language using a virtual machine; the best-known virtual machine may be the P-Code machine of UCSD Pascal.</p>
<h3 class="norm"><span style="color: #000000;">What is&nbsp;Java Virtual Machine?</span></h3>
<p class="norm">A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called bytecode) for a computer's processor (or "hardware platform") so that it can perform a Java program's instructions. Java was designed to allow application programs to be built that could be run on any platform without having to be rewritten or recompiled by the programmer for each separate platform. A Java virtual machine makes this possible because it is aware of the specific instruction lengths and other particularities of the platform.</p>
<div id="nmtbi4" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="41" data-ved="0ahUKEwi1kv_vsPPQAhXHW7wKHYp0AqoQuk4IKSgA">
<div class="_eHi">
<div id="nmtbi4" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="43" data-ved="0ahUKEwjCl-Sos_PQAhWCebwKHYReDq0Quk4IKygA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What do you mean by bytecode in Java?</span></h3>
</div>
</div>
<div id="nmtbi4cntw" class="nmcw nmbl nmca" data-hveid="44" data-ved="0ahUKEwjCl-Sos_PQAhWCebwKHYReDq0Qu04ILCgB">
<div id="nmtbi4cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="45"><span class="_Tgc _y9e">Programming code that, once compiled, is run through a virtual machine instead of the computer processor. Bytecode is the compiled format for Java programs. Once a Java program has been converted to bytecode, it can be transferred across a network and executed by Java Virtual Machine (JVM).</span></div>
</div>
</div>
</div>
</div>
<div id="nmtbi6" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="49" data-ved="0ahUKEwi1kv_vsPPQAhXHW7wKHYp0AqoQuk4IMSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">Is JVM is platform independent?</span></h3>
<div class="_rhf">The JVM is not written in Java and hence cannot be platform independent. The JVM must be platform dependent to allow your Java to run on the specific platform. A JVM for Windows will translate your Java into different system calls than a JVM for OS X.</div>
<h3 class="_rhf"><span style="color: #000000;">What is Oracle and Java?</span></h3>
<div class="_rhf">
<div id="nmtbi6" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="51" data-ved="0ahUKEwjCl-Sos_PQAhWCebwKHYReDq0Quk4IMygA">
<div class="_eHi">
<div class="_rhf"><strong>Java</strong> is a set of computer software and specifications developed by Sun Microsystems, later acquired by <strong>Oracle</strong> Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment.</div>
<h3 class="_rhf"><span style="color: #000000;">What is Java software for?</span></h3>
<div class="_rhf">
<div id="nmtbi8" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="59" data-ved="0ahUKEwjCl-Sos_PQAhWCebwKHYReDq0Quk4IOygA">
<div class="_eHi">
<div class="_rhf">Java is a programming language that developers use to create applications on your computer. Chances are you've downloaded a program that required the <strong>Java runtime</strong>, and so you probably have it installed it on your system. Java also has a web plug-in that allows you to run these apps in your browser.</div>
<div class="_rhf">&nbsp;</div>
<p class="norm">The first prototype implementation of the Java Virtual Machine, done at Sun Microsystems, Inc., emulated the Java Virtual Machine instruction set in software hosted by a handheld device that resembled a contemporary Personal Digital Assistant (PDA). Oracle's current implementations emulate the Java Virtual Machine on mobile, desktop and server devices, but the Java Virtual Machine does not assume any particular implementation technology, host hardware, or host operating system. It is not inherently interpreted, but can just as well be implemented by compiling its instruction set to that of a silicon CPU. It may also be implemented in microcode or directly in silicon.</p>
<p class="norm">The Java Virtual Machine knows nothing of the Java programming language, only of a particular binary format, the <code class="literal">class</code> file format. A <code class="literal">class</code> file contains Java Virtual Machine instructions (or <span class="emphasis"><em>bytecodes</em></span>) and a symbol table, as well as other ancillary information.</p>
<p class="norm">For the sake of security, the Java Virtual Machine imposes strong syntactic and structural constraints on the code in a <code class="literal">class</code> file. However, any language with functionality that can be expressed in terms of a valid <code class="literal">class</code> file can be hosted by the Java Virtual Machine. Attracted by a generally available, machine-independent platform, implementors of other languages can turn to the Java Virtual Machine as a delivery vehicle for their languages.</p>
<h3><span style="color: #000000;">Architecture of&nbsp;Java Virtual Machine</span></h3>
The JVM specification defines the subsystems and their external behavior. The JVM has the following major subsystems:
<p style="padding-left: 30px;"><strong>Class Loader</strong>. Responsible for reading Java source code and loading classes into the data areas.</p>
<p style="padding-left: 30px;"><strong>Execution Engine</strong>. Responsible for executing instructions from the data areas.The data areas occupy memory that is allocated by the JVM from the underlying OS.</p>
<p style="padding-left: 30px;"><img class=" wp-image-27762 aligncenter" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_25.jpg" alt="Screenshot_25" width="721" height="502" /></p>
<h3><span style="color: #000000;">Class Loader</span></h3>
The JVM uses different class loaders organized into the following hierarchy:
<ul>
<li>The bootstrap class loader is the parent for other class loaders. It loads the core Java libraries and is the only one written in native code.</li>
<li>The extension class loader is a child of the bootstrap class loader. It loads the extension libraries.</li>
<li>The system class loader is a child of the extension class loader. It loads the application class files that are found in the classpath.</li>
<li>A user-defined class loader is a child of the system class loader or another user-defined class loader.</li>
</ul>
When a class loader receives a request to load a class, it checks the cache to see if the class has already been loaded, then delegates the request to the parent. If the parent fails to load the class, then the child attempts to load the class itself. A child class loader can check the cache of the parent class loader, but the parent cannot see classes loaded by the child. The design is such because a child class loader should not be allowed to load classes that are already loaded by its parent.
<h3><span style="color: #000000;">Execution Engine</span></h3>
The execution engine executes commands from the bytecode loaded into the data areas one by one. To make the bytecode commands readable to the machine, the execution engine uses two methods.
<ul>
<li style="padding-left: 30px;"><strong>Interpretation</strong>. The execution engine changes each command to machine language as it is encountered.</li>
<li style="padding-left: 30px;"><strong>Just-in-time (JIT) compilation</strong>. If a method is used frequently, the execution engine compiles it to native code and stores it in the cache. After that, all commands associated with this method are executed directly without interpretation.</li>
</ul>
Although JIT compilation takes more time than interpretation, it is done only once for a method that might get called thousands of times. Running such method as native code saves a lot of execution time compared to interpreting each command one by one every time it is encountered. JIT compilation is not a requirement of the JVM specification, and it is not the only technique that is used to improve JVM performance. The specification defines only which bytecode commands relate to which native code; it is up to the implementation to define how the execution engine actually performs this conversion.
<h3><span style="color: #000000;">Memory Model</span></h3>
The Java memory model is built on the concept of automatic memory management. When an object is no longer referenced by an application, a garbage collector discards it and this frees up memory. This is different from many other programming languages, where you have to manually unload the object from memory. The JVM allocates memory from the underlying OS and separates it into the following areas.
<ul>
<li><strong>Heap Space</strong>. This is a shared memory area used to hold the objects that a garbage collector scans.</li>
<li><strong>Method Area</strong>. This area was previously known as the <em>permanent generation</em>where loaded classes were stored. It has recently been removed from the JVM, and classes are now loaded as metadata to native memory of the underlying OS.</li>
<li><strong>Native Area</strong>. This area holds references and variables of primitive types.</li>
</ul>
Breaking the heap up into generations ensures efficient memory management because the garbage collector does not need to scan the whole heap. Most objects live for a very short time, and those that survive longer will likely not need to be discarded at all until the application terminates. When a Java application creates an object, it is stored in the <strong>eden pool</strong> of the heap. Once it is full, a minor garbage collection is triggered at the eden pool. First, the garbage collector marks dead objects (those that are not referenced by the application any more) and increments the age of live objects (the age is represented by the number of garbage collections that the object has survived). Then the garbage collector discards dead objects and moves live objects to the <strong>survivor pool</strong>, leaving the eden pool clear. When a surviving object reaches a certain age, it is moved to the old generation of the heap: the <strong>tenured pool</strong>. Eventually, the tenured pool fills up and a major garbage collection is triggered to clean it up. When a garbage collection is performed, all application threads are stopped, causing a pause. Minor garbage collections are frequent, but are optimized to quickly remove dead objects, which are the major part of the young generation. Major garbage collections are much slower because they involve mostly live objects. There are different kinds of garbage collectors, some may be faster in certain situations when performing a major garbage collection. The heap size is dynamic. Memory is allocated to the heap only if it is required. When the heap fills up, the JVM reallocates more memory, until the maximum is reached. Memory reallocation also causes the application to stop briefly.
<h3><span style="color: #000000;">Threads</span></h3>
The JVM runs in a single process, but it can execute several threads concurrently, each one running its own method. This is an essential part of Java. An application such as an instant messenger client, runs at least two threads; one that waits for user input and one that checks the server for incoming messages. Another example is a server application that executes requests in different threads: sometimes each request can involve several threads running concurrently. All threads share the memory and other resources available to the JVM process. Each JVM process starts a main thread at the entry point (the main() method). Other threads are started from it and present an independent path of execution. Threads can run in parallel on separate processors, or they can share one processor. The thread scheduler controls how threads take turns executing on a single processor.
<h3><span style="color: #000000;">Performance Optimization</span></h3>
The performance of the JVM depends on how well it is configured to match the functionality of the application. Although memory is automatically managed using garbage collection and memory reallocation processes, you have control over their frequency. In general, the more memory you have available for your application, the less memory management processes are required, which pause your application. If garbage collections are occurring more frequently than you would want, you can start the JVM with more maximum heap size. The longer it takes for a generation of the heap to fill up, the fewer garbage collections occur. To configure the maximum heap size, use the -Xmx option when you start the JVM. By default, the maximum heap size is set to either 1/4th of the physical memory available to the OS, or to 1 GB (whichever is the smallest). If the problem is with memory reallocation, you can set the initial heap size to be the same as the maximum. This means that the JVM will never need to allocate more memory to the heap. However, you will also lose the adaptive memory optimization gained from dynamic heap sizing. The heap will be of fixed size from the moment you start your application. To configure the initial heap size, use the -Xms option when you start the JVM. By default, the initial heap size is set to either 1/64th of the physical memory available to the OS, or to some reasonable minimum that is different for different platforms (whichever is the largest). If you know which garbage collections (minor or major) are causing performance degradation, you can set the ratio between the young and old generations without changing the overall heap size. For applications that create a lot of short-lived objects, increase the size of the young generation (this will leave less memory for the old generation). For applications that operate with a lot of longer surviving objects, increase the size of the old generation (by setting less memory for the young generation). The following ways can be used to control the sizes of the young and old generations.
<ul>
<li style="padding-left: 30px;">Specify the ratio between the young and old generation using the -XX:NewRatio option when you start the JVM. For example, to make the old generation five times larger than the young generation, specify -XX:NewRatio=5. By default, the ratio is set to 2 (the old generation occupies ⅔ of the heap, and the young generation occupies ⅓).</li>
<li style="padding-left: 30px;">Specify the initial and maximum size of the young generation using the -Xmn option when you start the JVM. The old generation size will be set to whatever memory remains on the heap.</li>
<li style="padding-left: 30px;">Specify the initial and maximum size of the young generation separately, using the -XX:NewSize and -XX:MaxNewSize options when you start the JVM. The old generation size will be set to whatever memory remains on the heap.</li>
</ul>
Most applications (especially servers) require concurrent execution, handling a number of tasks. Some of these tasks are more important at a given moment, while others are background tasks that can be executed whenever the CPU is not busy doing anything else. Tasks are executed in different threads. For example, a server may have a low-priority thread that calculates statistics based on some data and starts a higher-priority thread to handle incoming data, and another higher-priority thread to serve a request for some of the data that was calculated. There can be many sources of data, and many clients requesting data from the server. Each request will briefly stop the execution of the background calculation thread to serve the request. So you have to monitor the number of threads that are running and make sure there is enough CPU time for the thread that is making the necessary calculations. Each thread has a stack that holds the method calls, return addresses, and so on. Some memory is allocated for the stack, and if there are too many threads, this can lead to an OutOfMemory error. Even if you have enough heap memory allocated for objects, your application may be unable to start a new thread. In this case, consider limiting the maximum size of the stack in threads. To configure the thread stack size, use the -Xss option when you start the JVM. By default, the thread stack size is set to 320 KB or 1024 KB, depending on the platform.
<h3><span style="color: #000000;">Performance Monitoring</span></h3>
Whether you are developing or running a Java application, it is important to monitor the performance of the JVM. Configuring the JVM is not a one-time affair, especially if you are dealing with a server running on Java. You have to constantly check the allocation and usage of both heap and non-heap memory, the number of threads that the application creates, and the number of classes that are loaded into memory. These are the core parameters. Using the Anturis Console, you can <a href="https://anturis.com/jvm-monitoring/">set up monitoring of the JVM</a> for any hardware component (such as a computer running a Tomcat web server) in your infrastructure by adding the JVM monitor to the component. The JVM monitor can measure the following metrics.
<ul>
<li>Total memory usage (MB) is the amount of memory that the JVM uses. This metric can affect overall performance of the underlying OS if the JVM consumes all available memory.</li>
<li>Heap memory usage (MB) is the amount of memory that the JVM allocates for objects used by the running Java application. Unused objects are regularly removed from the heap by the garbage collector. If this metric grows, it can indicate that your application is not removing references for unused objects, or that you need to configure the garbage collector properly.</li>
<li>Non-Heap memory usage (MB) is the amount of memory allocated for the method area and the code cache. The method area is used to store references to loaded classes. If these references are not removed properly, the permanent generation pool can increase every time the application is redeployed, leading to a non-heap memory leak. It can also indicate a thread-creation leak.</li>
<li>Total pool memory usage (MB) is all the memory used by the various memory pools allocated by the JVM (that is, the total memory without the code cache area). This can give you an idea of how much memory your application consumes without the JVM overhead.</li>
<li>Threads (threads) is the number of active threads in the JVM. For example, each request to a Tomcat server is processed in a separate thread, so this metric can give you an idea of the number of requests that are currently being served, and whether it affects the background tasks that are running in threads set to a lower priority.</li>
<li>Classes (classes) is the number of loaded classes. If your application dynamically creates a lot of classes, this can be a source of a severe memory leak.</li>
</ul>
<h3><span style="color: #000000;"><strong>JamVM</strong></span></h3>
JamVM is an open-source Java Virtual Machine that aims to support the latest version of the JVM specification, while at the same time being compact and easy to understand. JamVM must be used in conjunction with a Java class-library to make a full Java Runtime Environment. Compatible class-libraries are GNU Classpath or the class-library from OpenJDK.
<h2><span style="color: #000000;">Java Virtual Machine Features</span></h2>
For those interested in the design of virtual machines, JamVM includes a number of optimisations to improve speed and reduce foot-print. A list, in no particular order, is given below.
<ul>
<li style="padding-left: 30px;">Execution engine supports many levels of optimisation from basic switched interpreter to inline-threaded interpreter with stack-caching (equivalent performance to a simple JIT).</li>
<li style="padding-left: 30px;">Uses native threading (posix threads). Full thread implementation including <code>Thread.interrupt()</code></li>
<li style="padding-left: 30px;">Object references are direct pointers (i.e. no handles)</li>
<li style="padding-left: 30px;">Supports class loaders</li>
<li style="padding-left: 30px;">Efficient thin locks for fast locking in uncontended cases (the majority of locking) without using spin-locking</li>
<li style="padding-left: 30px;">Two word object header to minimise heap overhead (lock word and class pointer)</li>
<li style="padding-left: 30px;">Stop-the-world garbage collector, with separate mark/sweep and mark/compact phases to minimise heap fragmentation</li>
<li style="padding-left: 30px;">Thread suspension uses signals to reduce suspend latency and improve performance (no suspension checks during normal execution)</li>
<li style="padding-left: 30px;">Full object finalisation support within the garbage collector (with finaliser thread)</li>
<li style="padding-left: 30px;">Full support for Soft/Weak/Phantom References (with Reference Handler thread)</li>
<li style="padding-left: 30px;">Full support for class and class-loader garbage-collection and unloading (including associated shared libraries)</li>
<li style="padding-left: 30px;">Garbage collector can run synchronously or asynchronously within its own thread</li>
<li style="padding-left: 30px;">String constants within class files are stored in hash table to minimise class data overhead (string constants shared between all classes)</li>
<li style="padding-left: 30px;">Supports JNI and dynamic loading for use with standard libraries</li>
<li style="padding-left: 30px;">Uses its own lightweight native interface for internal native methods without overhead of JNI</li>
<li style="padding-left: 30px;">VM support for invokedynamic (JSR 292)</li>
<li style="padding-left: 30px;">VM support for type annotations (JSR 308)</li>
<li style="padding-left: 30px;">VM support for lambda expressions (JSR 335)</li>
<li style="padding-left: 30px;">VM support for method parameter reflection</li>
<li style="padding-left: 30px;">JamVM is written in C, with a small amount of platform dependent assembler, and is easily portable to other architectures.</li>
</ul>
For detail info on Java click on</div>
<div class="_eHi"><a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java Tutorials</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>2f:T2758,<h2><span style="color: #e67e23;">What is an Interface in Java?</span></h2>
<p><span class="_Tgc">An interface in the Java programming language is an abstract type that is used to specify a behavior that classes must implement. ... Interfaces cannot be instantiated, but rather are implemented. A class that implements an interface must implement all of the methods described in the interface, or be an abstract class.</span> For example, we might have defined the following interface for classes that have a position.</p>
<pre class="page" style="padding-left: 30px;"><code class="j">public&nbsp;interface&nbsp;<tt>Locatable</tt>&nbsp;{
 &nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;double&nbsp;<tt>getX</tt>();
 &nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;double&nbsp;<tt>getY</tt>();
 }
 </code></pre>
<p>With the interface defined, we will now need classes that claim to implement the interface. For this, we need to say so up front using an <code class="j"><strong>implements</strong></code> clause.</p>
<pre class="frag" style="padding-left: 30px;"><code class="j">public&nbsp;class&nbsp;<tt>Ball</tt>&nbsp;implements&nbsp;<tt>Locatable</tt>&nbsp;{&nbsp;<em class="rem">//...</em>
 public&nbsp;class&nbsp;<tt>Paddle</tt>&nbsp;extends&nbsp;<tt>Block</tt>&nbsp;implements&nbsp;<tt>Locatable</tt>&nbsp;{&nbsp;<em class="rem">//...</em>
 </code></pre>
<p>Any class that has such an <code class="j"><strong>implements</strong></code> clause has to define all of the methods defined in the interface. Otherwise, there's a compiler error. Thus, both <code class="j"><tt>Ball</tt></code> and <code class="j"><tt>Paddle</tt></code> must have <code class="j"><tt>getX</tt></code> and <code class="j"><tt>getY</tt></code> methods; since the interface says these methods take no parameters and return a <code class="j"><strong>double</strong></code>, they need to be defined this way in <code class="j"><tt>Ball</tt></code> and <code class="j"><tt>Paddle</tt></code> too. What makes interfaces useful is that they are types, too. The following would be completely legitimate.</p>
<pre style="padding-left: 30px;"><code class="j"><tt>Locatable</tt>&nbsp;<tt>loc</tt>&nbsp;=&nbsp;<strong>new</strong>&nbsp;<tt>Ball</tt>();
 <tt>System</tt>.<tt>out</tt>.<tt>println</tt>(<tt>loc</tt>.<tt>getX</tt>()&nbsp;+&nbsp;<em>",&nbsp;"</em>&nbsp;+&nbsp;<tt>loc</tt>.<tt>getY</tt>());
 <tt>loc</tt>&nbsp;=&nbsp;<strong>new</strong>&nbsp;<tt>Paddle</tt>();
 <tt>System</tt>.<tt>out</tt>.<tt>println</tt>(<tt>loc</tt>.<tt>getX</tt>()&nbsp;+&nbsp;<em>",&nbsp;"</em>&nbsp;+&nbsp;<tt>loc</tt>.<tt>getY</tt>());
 </code></pre>
<p>You cannot create an instance of an interface: <q><code class="j"><strong>new</strong>&nbsp;<tt>Locatable</tt>()</code></q> would be illegal. In some sense, with interfaces a class have two <q>superclasses.</q> Only one of these can be a true Java class, but the type conversion behavior makes it feel as if both the actual parent class and the implemented interface are superclasses.</p>
<h3><span style="color: #000000;">Rules of Using Interface</span></h3>
<ul>
<li style="padding-left: 30px;">Methods inside Interface must not be static, final, native or strictfp.</li>
<li style="padding-left: 30px;">All variables declared inside interface are implicitly public static final variables(constants).</li>
<li style="padding-left: 30px;">All methods declared inside Java Interfaces are implicitly public and abstract, even if you don't use public or abstract keyword.</li>
<li style="padding-left: 30px;">Interface can extend one or more other interface.</li>
<li style="padding-left: 30px;">Interface cannot implement a class.</li>
<li style="padding-left: 30px;">Interface can be nested inside another interface.</li>
</ul>
<div id="nmtbi12" class="_qhf _grf nmiw nmtbi nmt nmtbia " style="display: inline !important;" data-hveid="96" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQuk4IYCgA">
<div class="_eHi" style="display: inline !important;">
<h4 class="_rhf" style="display: inline !important;">&nbsp;</h4>
<h4 class="_rhf" style="display: inline !important;"><span style="color: #000000;">What is JNI?</span></h4>
<p>&nbsp;</p>
In computing, the<a href="https://en.wikipedia.org/wiki/Java_Native_Interface" target="_blank" rel="noopener"> Java Native Interface (JNI)</a> is a programming framework that enables Java code running in a Java Virtual Machine (JVM) to call and be called by native applications (programs specific to a hardware and operating system platform) and libraries written in other languages such as C, C++ and assembly.
<div id="nmtbi14" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="104" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQuk4IaCgA">
<div class="_eHi">
<h4 class="_rhf"><span style="color: #000000;">What is a computer interface?</span></h4>
</div>
</div>
<div id="nmtbi14cntw" class="nmcw nmbl nmca" data-hveid="105" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQu04IaSgB">
<div id="nmtbi14cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="106"><span class="_Tgc _y9e">In computing, an interface is a shared boundary across which two separate components of a computer system exchange information. The exchange can be between software, computer hardware, peripheral devices, humans and combinations of these.</span></div>
<div class="_oDd" data-hveid="106">
<div id="nmtbi16" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="112" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQuk4IcCgA">
<div class="_eHi">
<h4 class="_rhf"><span style="color: #000000;">What is a software interface?</span></h4>
</div>
</div>
<div id="nmtbi16cntw" class="nmcw nmbl nmca" data-hveid="113" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQu04IcSgB">
<div id="nmtbi16cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="114"><span class="_Tgc _y9e">user interface - the keyboard, mouse, menus of a computer system. The user interface allows the user to communicate with the operating system. Also see <a href="https://en.wikipedia.org/wiki/Widget_(GUI)" target="_blank" rel="noopener">GUI</a>. software interface - the languages and codes that the applications use to communicate with each other and with the hardware.</span></div>
<div class="_oDd" data-hveid="114">
<div id="nmtbi18" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="120" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQuk4IeCgA">
<div class="_eHi">
<h4 class="_rhf"><span style="color: #000000;">What is the meaning of native code in Java?</span></h4>
</div>
</div>
<div id="nmtbi18cntw" class="nmcw nmbl nmca" data-hveid="121" data-ved="0ahUKEwiT9NbZrPXQAhWJErwKHTTFCrIQu04IeSgB">
<div id="nmtbi18cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="122"><span class="_Tgc _y9e">Native code is computer programming (code) that is compiled to run with a particular processor (such as an Intel x86-class processor) and its set of instructions. If the same program is run on a computer with a different processor, software can be provided so that the computer emulates the original processor.</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<h3><span style="color: #000000;">Interface implementation</span></h3>
<p>To declare a class that implements an interface, you include an <code>implements</code> clause in the class declaration. Your class can implement more than one interface, so the <code>implements</code> keyword is followed by a comma-separated list of the interfaces implemented by the class. By convention, the <code>implements</code> clause follows the <code>extends</code> clause, if there is one.</p>
<h4><span style="color: #000000;">Example of Interface implementation</span></h4>
<pre class="java" style="padding-left: 30px;">interface Moveable 
{
 int AVG-SPEED = 40;
 void move();
}

class Vehicle implements Moveable 
{
 public void move()
 {
  System .out. print in ("Average speed is"+AVG-SPEED");
 }
 public static void main (String[] arg)
 {
  Vehicle vc = new Vehicle();
  vc.move();
 }
}</pre>
<h3><span style="color: #000000;">Difference between an interface and an abstract class?</span></h3>
<table style="height: 615px;" width="895">
<tbody>
<tr>
<td width="325">
<p style="text-align: center;"><strong>Abstract class</strong></p>
</td>
<td width="325">
<p style="text-align: center;"><strong>Interface</strong></p>
</td>
</tr>
<tr>
<td width="325">Abstract class is a class which contain one or more abstract methods, which has to be implemented by its sub classes.</td>
<td width="325">Interface is a Java Object containing method declaration but no implementation. The classes which implement the Interfaces must provide the method definition for all the methods.</td>
</tr>
<tr>
<td width="325">Abstract class is a Class prefix with an abstract keyword followed by Class definition.</td>
<td width="325">Interface is a pure abstract class which starts with interface keyword.</td>
</tr>
<tr>
<td width="325">Abstract class can also contain concrete methods.</td>
<td width="325">Whereas, Interface contains all abstract methods and final variable declarations.</td>
</tr>
<tr>
<td width="325">Abstract classes are useful in a situation that Some general methods should be implemented and specialization behavior should be implemented by child classes.</td>
<td width="325">Interfaces are useful in a situation that all properties should be implemented.</td>
</tr>
<tr>
<td width="325">Abstract class does not support multiple inheritance</td>
<td width="325">Interface support multiple inheritance</td>
</tr>
<tr>
<td width="325">Only complete Member of abstract class can be static</td>
<td width="325">Member of interface cannot be static</td>
</tr>
</tbody>
</table>
<p><a href="http://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener"> </a><strong><span style="color: #000000;">For Indepth understanding of Java Click on</span></strong></p>
<p><a href="https://tekslate.com/java-virtual-machine-java/" target="_blank" rel="noopener">Java Virtual Machines</a></p>30:T3201,<h2><span style="color: #e67e23; font-size: 20px;">What is Exception Handling in java?</span></h2>
<p style="text-align: justify;">The exception is an error event that can happen during the execution of a program and disrupts its normal flow. Java provides a robust and object-oriented way to handle exception scenarios, known as Java Exception Handling.</p>
<p style="text-align: justify;">Java is an object-oriented programming language, whenever an error occurs while executing a statement, creates an exception objec<strong>t</strong> and then the normal flow of the program halts and JRE tries to find someone that can handle the raised exception. The exception object contains a lot of debugging information such as method hierarchy, line number where the exception occurred, type of exception etc. When the exception occurs in a method, the process of creating the exception object and handing it over to the runtime environment is called &ldquo;throwing the exception&rdquo;.</p>
<table style="border-collapse: collapse; width: 100.012%; height: 120px;" border="1px" cellpadding="10">
<tbody>
<tr>
<td style="width: 98.4238%;">
<h3><strong>Table of Contents</strong></h3>
<ul>
<li><a href="#error-in-java"><span style="color: #236fa1;">What is an error in Java?</span></a></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#exception-hierarchy-in-java">What is exception hierarchy in Java?</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#base-class-for-all-exceptions">What is the base class for all exceptions?</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#use-of-exception-handling">Why do we use Exception Handling?</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#type-of-exception">Type of Exception</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#java-exception-hierarchy">Java Exception Hierarchy</a></span></li>
</ul>
</td>
</tr>
</tbody>
</table>
<div id="nmtbi13" class="_qhf _grf nmiw nmtbi nmt " data-hveid="94" data-ved="0ahUKEwjWvJ_Qv_XQAhUJxrwKHQToCJQQuk4IXigA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #e67e23;"><strong><span style="font-size: 16px;"><a id="error-in-java" style="color: #e67e23;"></a>What is an error in Java?</span></strong></span></h3>
</div>
</div>
<p style="text-align: justify;">An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.</p>
<div id="nmtbi15" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="102" data-ved="0ahUKEwjWvJ_Qv_XQAhUJxrwKHQToCJQQuk4IZigA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #e67e23;"><strong><span style="font-size: 16px;"><a id="exception-hierarchy-in-java" style="color: #e67e23;"></a>What is exception hierarchy in Java?</span></strong></span></h3>
<p style="text-align: justify;">Exception Hierarchy: All exception classes are subtypes of the java.lang.Exception class. The exception class is a subclass of the Throwable class. Other than the exception class there is another subclass called Error which is derived from the Throwable class.</p>
<div class="_rhf">
<div id="nmtbi15" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="99" data-ved="0ahUKEwirpf7LwvXQAhUENrwKHUnnDrsQuk4IYygA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #e67e23;"><strong><span style="font-size: 16px;"><a id="base-class-for-all-exceptions" style="color: #e67e23;"></a>What is the base class for all exceptions?</span></strong></span></h3>
</div>
</div>
<div id="nmtbi15cntw" class="nmcw nmbl nmca" data-hveid="100" data-ved="0ahUKEwirpf7LwvXQAhUENrwKHUnnDrsQu04IZCgB">
<div id="nmtbi15cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<p style="text-align: justify;">Firstly, the base class of all things that can be thrown is Throwable (not Exception ). Under Throwable are two subclasses: Exception and Error. Of these 4 main classes, RuntimeException and Error are unchecked (may be thrown without having to be declared as being thrown).</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="_rhf">
<h2 class="voiletcolor"><span style="color: #e67e23; font-size: 20px;"><a id="use-of-exception-handling" style="color: #e67e23;"></a>Why do we use Exception Handling?</span></h2>
<p style="text-align: justify;">Handling the exception is nothing but converting system error-generated messages into user-friendly error messages. Whenever an exception occurs in the java application, JVM will create an object of appropriate exception of subclass and generates a system error message, these system-generated messages are not understandable by the user so need to convert it into a user-friendly error message. You can convert system error messages into user-friendly error messages by using the exception handling feature of java.</p>
<p style="text-align: justify;">For Example: when you divide any number by zero the system generates <strong>/ </strong>by zero so this is not understandable by the user you can convert this message into a user-friendly error message like Don't enter zero for the denominator<strong>.</strong></p>
<img class="aligncenter wp-image-27789" title="Exception Handling in java" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_26.jpg" alt="Exception Handling in java" width="767" height="574" />
<h3><span style="color: #e67e23;"><strong><span style="font-size: 16px;"><a id="type-of-exception" style="color: #e67e23;"></a>Type of Exception</span></strong></span></h3>
<ul>
<li>Checked Exception</li>
<li>Un-Checked Exception</li>
</ul>
<h4 class="h4"><span style="color: #e67e23;">Checked Exception</span></h4>
<p style="padding-left: 30px; text-align: justify;">The classes that extend Throwable class except RuntimeException and Error are known as checked exceptions e.g.IOException, SQLException etc. Checked exceptions are checked at compile-time.</p>
<h4 class="h4"><span style="color: #e67e23;"><strong>Unchecked Exception</strong></span></h4>
<p style="padding-left: 30px; text-align: justify;">The classes that extend Runtime Exception are known as unchecked exceptions e.g. Arithmetic Exception, NullPointerException, Array Index Out Of Bounds Exception etc. Unchecked exceptions are not checked at compile-time rather they are checked at runtime.</p>
<h3 class="h2"><span style="color: #e67e23;">Java Exception Handling Keywords</span></h3>
<p style="text-align: justify;">There are 5 keywords used in java exception handling.</p>
<ul style="list-style-type: disc;">
<li style="text-align: justify;"><strong>throw</strong>: We know that if any exception occurs, an exception object is getting created and then Java runtime starts processing to handle them. Sometime we might want to generate exception explicitly in our code, for example in a user authentication program we should throw exception to client if the password is null. <strong>throw</strong> keyword is used to throw exception to the runtime to handle it.</li>
<li style="text-align: justify;"><strong>throws</strong>: When we are throwing any exception in a method and not handling it, then we need to use <strong>throws</strong> keyword in method signature to let caller program know the exceptions that might be thrown by the method. The caller method might handle these exceptions or propagate it to it&rsquo;s caller method using throws keyword. We can provide multiple exceptions in the throws clause and it can be used with main() method also.</li>
<li style="text-align: justify;"><strong>try-catch</strong>: We use try-catch block for exception handling in our code. try is the start of the block and catch is at the end of try block to handle the exceptions. We can have multiple catch blocks with a try and try-catch block can be nested also. catch block requires a parameter that should be of type Exception.</li>
<li style="text-align: justify;"><strong>finally</strong>: finally block is optional and can be used only with try-catch block. Since exception halts the process of execution, we might have some resources open that will not get closed, so we can use finally block. finally block gets executed always, whether exception occurred or not.</li>
</ul>
<h4><strong><span style="color: #000000;">Syntax for handling the exception</span></strong></h4>
<pre class="language-markup"><code>try
{
  // statements cause problems at run time 
}
catch(type of exception-1 object-1)
{
  // statements provide a user-friendly error message 
}
catch(type of exception-2 object-2)
{
  // statements provide a user-friendly error message
}
finally
{
  // statements that will execute compulsory 
}</code></pre>
<pre class="prettyprint prettyprinted"><span style="color: #000000;"><strong>Example without Exception Handling</strong></span></pre>
<pre class="language-markup"><code>class ExceptionDemo 
{
public static void main(String[] args) 
{
int a=10, ans=0;
ans=a/0;
System.out.println("Denominator not be zero");		
}
}</code></pre>
<h4><span style="color: #000000;"><strong>Example of Exception Handling</strong></span></h4>
<div class="example">
<pre class="language-markup"><code>class ExceptionDemo 
{
public static void main(String[] args) 
{
int a=10, ans=0;
try
{
ans=a/0;
}
catch (Exception e)
{
System.out.println("Denominator not be zero");
}	
}
}</code></pre>
<p class="prettyprint prettyprinted"><strong><span style="font-family: Helvetica, Arial, sans-serif;">Output:</span></strong></p>
<p class="prettyprint prettyprinted"><span style="font-family: Helvetica, Arial, sans-serif;">Denominator not be zero</span></p>
</div>
<h2 class="code"><span style="color: #e67e23;"><strong><a id="java-exception-hierarchy" style="color: #e67e23;"></a>Java Exception Hierarchy</strong></span></h2>
<p>As stated earlier, when any exception is raised an exception object is getting created. Java Exceptions are hierarchical and inheritance is used to categorize different types of exceptions. Throwable is the parent class of Java Exceptions Hierarchy and it has two child objects &ndash; Error and Exception. Exceptions are further divided into checked exceptions and runtime exception.</p>
<ul>
<li><strong>Errors:</strong> Errors are exceptional scenarios that are out of scope of application and it&rsquo;s not possible to anticipate and recover from them, for example hardware failure, JVM crash or out of memory error. That&rsquo;s why we have a separate hierarchy of errors and we should not try to handle these situations. Some of the common Errors are OutOfMemoryError and StackOverflowError.</li>
<li><strong>Checked Exceptions:</strong> Checked Exceptions are exceptional scenarios that we can anticipate in a program and try to recover from it, for example FileNotFoundException. We should catch this exception and provide useful message to user and log it properly for debugging purpose. Exception is the parent class of all Checked Exceptions and if we are throwing a checked exception, we must catch it in the same method or we have to propagate it to the caller using throws keyword.</li>
<li><strong>Runtime Exception:</strong> Runtime Exceptions are cause by bad programming, for example trying to retrieve an element from the Array. We should check the length of array first before trying to retrieve the element otherwise it might throw ArrayIndexOutOfBoundException at runtime. RuntimeException is the parent class of all runtime exceptions. If we are throwing any runtime exception in a method, it&rsquo;s not required to specify them in the method signature throws clause. Runtime exceptions can be avoided with better programming.</li>
</ul>
</div>
<div id="nmtbi15" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="102" data-ved="0ahUKEwjWvJ_Qv_XQAhUJxrwKHQToCJQQuk4IZigA">
<div class="_eHi">
<h3 class="_rhf"><img class="aligncenter wp-image-27791" title="Exception Handling in java-Exception Hierarchy" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_27.jpg" alt="Exception Handling in java" width="837" height="400" /></h3>
<h4><span style="color: #000000;"><strong>For indepth understanding of Java Click on:</strong></span></h4>
<a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java Tutorials</a>
<div class="_rhf"><a href="https://tekslate.com/java-virtual-machine-java/" target="_blank" rel="noopener">Java virtual Machines</a></div>
<div class="_rhf"><a href="https://tekslate.com/java-interface-in-java/" target="_blank" rel="noopener">Interface in Java</a></div>
</div>
</div>31:T3985,<h2><span style="color: #e67e23;">Multithreading in java</span></h2>
<p>Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Each part of such program is called a thread. So, threads are light-weight processes within a process.</p>
<p><strong>Example of Multi-thread:</strong></p>
<pre>package demotest;
public class GuruMultithread implements Runnable{

    /**
     * @param args
     */
    public static void main(String[] args) {
             Thread guruthread1 = new Thread();
             guruthread1.start();
             Thread guruthread2 = new Thread();
             guruthread2.start();
    }
    @Override
    public void run() {
        // TODO Auto-generated method stub        
    }
}</pre>
<h3><span style="color: #000000;">Life Cycle of a Thread</span></h3>
<p>A thread goes through various stages in its life cycle. For example, a thread is born, started, runs, and then dies. The following diagram shows the complete life cycle of a thread. <img class="aligncenter wp-image-27835" title="Multithreading in java-Life Cycle of a Thread" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_28.jpg" alt="Multithreading in java" width="511" height="441" /></p>
<p>There are various stages in life cycle of thread as shown in above diagram:</p>
<ul>
<li><strong>New:</strong> In this phase, the thread is created using class "Thread class".It remains in this state till the program <strong>starts</strong> the thread. It is also known as born thread.</li>
<li><strong>Runnable:</strong> In this page, the instance of the thread is invoked with a start method. The thread control is given to scheduler to finish the execution. It depends on the scheduler, whether to run the thread.</li>
<li><strong>Running:</strong> When the thread starts executing then the state is changed to "running" state. The scheduler selects one thread from the thread pool, and it starts executing in the application.</li>
<li><strong>Waiting:</strong> This is the state when a thread has to wait. As there are multiple threads running in the application, there is a need for synchronization between threads. Hence, one thread has to wait, till the other thread get executed. Therefore, this state is referred as waiting state.</li>
<li><strong>Dead:</strong> This is the state when the thread is terminated. The thread is in running state and as soon as it completed processing it is in "dead state".</li>
</ul>
<p>Threads can be created by using two mechanisms :</p>
<ul>
<li>Extending the Thread class</li>
<li>Implementing the Runnable Interface</li>
</ul>
<h3><span style="color: #000000;">Extending Thread Class in Java Example</span></h3>
<p>One way to create a thread is to create a new class that extends Thread, and then to create an instance of that class. The extending class must override the run() method, which is the entry point for the new thread. It must also call start() to begin execution of the new thread. <img class=" wp-image-27841 aligncenter" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_29.jpg" alt="Screenshot_29" width="861" height="254" /></p>
<pre class="prettyprint">class ExtendingThread extends Thread 
&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String s[]={"Welcome","to","Java","Programming","Language"}; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static void main(String args[]) 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;ExtendingThread t=new ExtendingThread("Extending Thread Class"); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public ExtendingThread (String n) 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super(n); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; start(); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;} 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; public void run() 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String name=getName(); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(int i=0;i&lt;s.length;i++) 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;try 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sleep(500); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; } 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; catch(Exception e) 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(name+":"+s[i]); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</pre>
<h3><span style="color: #000000;">Implementing the Runnable Interface</span></h3>
<p>The <code>Clock</code> applet displays the current time and updates its display every second. You can scroll the page and perform other tasks while the clock updates. The reason is that the code that updates the clock's display runs within its own thread. The <code>Clock</code> applet uses a technique different from <code>SimpleThread</code>&rsquo;s for providing the <code>run</code> method for its thread. Instead of subclassing <code>Thread</code>, <code>Clock</code> implements the <code>Runnable</code> interface and therefore implements the <code>run</code> method defined in it. <code>Clock</code> then creates a thread with itself as the <code>Thread</code>&rsquo;s target. When created in this way, the <code>Thread</code> gets its run method from its target. The code that accomplishes this is highlighted:</p>
<pre style="padding-left: 30px;">import java.awt.Graphics;
import java.util.*;
import java.text.DateFormat;
import java.applet.Applet;

public class Clock extends Applet implements Runnable {
    private Thread clockThread = null;
    public void start() {
        if (clockThread == null) {
            clockThread = new Thread(this, "Clock");
            clockThread.start();
        }
    }
    <strong>pu</strong>blic void run() {
        Thread myThread = Thread.currentThread();
        while (clockThread == myThread) {
            repaint();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                //the VM doesn&rsquo;t want us to sleep anymore,
                //so get back to work<strong>
            }
        }
    }</strong>
    public void paint(Graphics g) {
        //get the time and convert it to a date
        Calendar cal = Calendar.getInstance();
        Date date = cal.getTime();
        //format it and display it
        DateFormat dateFormatter =
				DateFormat.getTimeInstance();
        g.drawString(dateFormatter.format(date), 5, 10);
    }
    //overrides Applet&rsquo;s stop method, not Thread&rsquo;s
    public void stop() {
        clockThread = null;
    }
}</pre>
<h2 style="display: inline !important;"><span lang="EN-US" style="color: #000000;">Java Supports Multithreading</span></h2>
<ul>
<li><span lang="EN-US">Java's multithreading support is centered around the </span><tt><span lang="EN-US">java.lang.Thread</span></tt><span lang="EN-US"> class. The </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> class provides the capability to create objects of class </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US">, each with its own separate flow of control. The&nbsp;</span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> class encapsulates the data and methods associated with separate threads of execution and allows multithreading to be integrated within the object-oriented framework.</span></li>
<li><span lang="EN-US">Java provides two approaches to creating threads. In the first approach, you create a subclass of class </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> and override the </span><tt><span lang="EN-US">run()</span></tt><span lang="EN-US"> method to provide an entry point into the thread's execution. When you create an instance of your </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> subclass, you invoke its </span><tt><span lang="EN-US">start()</span></tt><span lang="EN-US"> method to cause the thread to execute as an independent sequence of instructions. The </span><tt><span lang="EN-US">start()</span></tt><span lang="EN-US"> method is inherited from the </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> class. It initializes the </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> object using your operating system's multithreading capabilities and invokes the </span><tt><span lang="EN-US">run()</span></tt><span lang="EN-US"> method. You learn how to create threads using this approach in the next section.</span></li>
<li><span lang="EN-US">The approach to creating threads identified in the previous paragraph is very simple and straightforward. However, it has the drawback of requiring your </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> objects to be under the </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> class in the class hierarchy. In some cases, as you'll see when you study applets in Part VI, "Programming the Web with Applets and Scripts," this requirement can be somewhat limiting.</span></li>
<li><span lang="EN-US">Java's other approach to creating threads does not limit the location of your </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US"> objects within the class hierarchy. In this approach, your class implements the </span><tt><span lang="EN-US">java.lang.Runnable</span></tt><span lang="EN-US"> interface. The&nbsp;</span><tt><span lang="EN-US">Runnable</span></tt><span lang="EN-US"> interface consists of a single method, the </span><tt><span lang="EN-US">run()</span></tt><span lang="EN-US"> method, which must be overridden by your class. The </span><tt><span lang="EN-US">run()</span></tt><span lang="EN-US"> method provides an entry point into your thread's execution. In order to run an object of your class as an independent thread, you pass it as an argument to a constructor of class </span><tt><span lang="EN-US">Thread</span></tt><span lang="EN-US">. You learn how to create threads using this approach later in this chapter in the section titled "Implementing&nbsp;</span><tt><span lang="EN-US">Runnable</span></tt><span lang="EN-US">."</span></li>
</ul>
<h2 class="h2" style="display: inline !important;"><span style="color: #000000;">Multitasking</span></h2>
<p>Multitasking is a process of executing multiple tasks simultaneously. We use multitasking to utilize the CPU. Multitasking can be achieved by two ways:</p>
<ul style="list-style-type: disc;">
<li>Process-based Multitasking(Multiprocessing)</li>
<li>Thread-based Multitasking(Multithreading)</li>
</ul>
<h3 class="h3"><span style="color: #000000;">Process-based Multitasking (Multiprocessing)</span></h3>
<ul style="list-style-type: disc;">
<li>Each process have its own address in memory i.e. each process allocates separate memory area.</li>
<li>Process is heavyweight.</li>
<li>Cost of communication between the process is high.</li>
<li><a href="https://en.wikipedia.org/wiki/Switching" target="_blank" rel="noopener">Switching</a> from one process to another require some time for saving and loading registers, memory maps, updating lists etc.</li>
</ul>
<h3 class="h3"><span style="color: #000000;">Thread-based Multitasking (Multithreading)</span></h3>
<ul style="list-style-type: disc;">
<li>Threads share the same address space.</li>
<li>Thread is lightweight.</li>
<li>Cost of communication between the thread is low.</li>
</ul>
<h3 class="h3"><span style="color: #000000;">Advantages of Java Multithreading</span></h3>
<ul>
<li>It doesn't block the user because threads are independent and you can perform multiple operations at same time.</li>
<li>You can perform many operations together so it saves time.</li>
<li>Threads are independent so it doesn't affect other threads if exception occur in a single thread.</li>
</ul>
<p><span style="color: #000000;"><strong>For indepth understanding of Java click on</strong></span></p>
<p><a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java Tutorials</a></p>
<p><a href="https://tekslate.com/java-virtual-machine-java/" target="_blank" rel="noopener">Java Virtual Machine</a></p>
<p><a href="https://tekslate.com/java-interface-in-java/" target="_blank" rel="noopener">Interface in Java</a></p>
<p><a href="https://tekslate.com/exception-handling-in-java/" target="_blank" rel="noopener">Exception Handling in Java</a> &nbsp;</p>32:T2eea,<h2><span style="color: #000000;">Polymorphism in Java</span></h2>
<p>Polymorphism is one of the major building blocks of object oriented programming along with inheritance, abstraction and encapsulation. Polymorphism is an Oops concept which advice use of common interface instead of concrete implementation while writing code. When we program for interface our code is capable of handling any new requirement or enhancement arise in near future due to new implementation of our common interface. If we don't use common interface and rely on concrete implementation, we always need to change and duplicate most of our code to support new implementation. Its not only Java but other object oriented language like C++ also supports polymorphism and it comes as fundamental along with other <a href="https://en.wikipedia.org/wiki/Object-oriented_programming" target="_blank" rel="noopener">OOPS</a> concepts like Encapsulation , Abstraction and Inheritance. An example of polymorphism is referring the instance of subclass, with reference variable of super-class. e.g.</p>
<pre style="padding-left: 30px;">Object o = new Object(); //o can hold the reference of any subtype
Object o = new String();
Object o = new Integer();</pre>
<div id="nmtbi6" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="56" data-ved="0ahUKEwiVsrL3kfjQAhWKK48KHfGeAnkQuk4IOCgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is meant by run time polymorphism in Java?</span></h3>
<div class="_rhf">Dynamic (run time) polymorphism is the polymorphism existed at run-time. Here, Java compiler does not understand which method is called at compilation time. Only JVM decides which method is called at run-time. Method overloading and method overriding using instance methods are the examples for dynamic polymorphism.</div>
<h3 class="_rhf"><span style="color: #000000;">What is meant by compile time polymorphism?</span></h3>
<div class="_rhf">
<div id="nmtbi8cntw" class="nmcw nmbl nmca" data-hveid="65" data-ved="0ahUKEwiVsrL3kfjQAhWKK48KHfGeAnkQu04IQSgB">
<div id="nmtbi8cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="66"><span class="_Tgc _y9e">It is also known as Static binding, Early binding and overloading as well. It is also known as Dynamic binding, Late binding and overriding as well. Overloading is compile time polymorphism where more than one methods share the same name with different parameters or signature and different return type.</span></div>
<div class="_oDd" data-hveid="66">
<div id="nmtbi10" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="72" data-ved="0ahUKEwiVsrL3kfjQAhWKK48KHfGeAnkQuk4ISCgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is runtime polymorphism or dynamic method dispatch in Java?</span></h3>
</div>
</div>
<div id="nmtbi10cntw" class="nmcw nmbl nmca" data-hveid="73" data-ved="0ahUKEwiVsrL3kfjQAhWKK48KHfGeAnkQu04ISSgB">
<div id="nmtbi10cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="74"><span class="_Tgc _y9e">Dynamic method dispatch is a mechanism by which a call to an overridden method is resolved at runtime. This is how java implements runtime polymorphism. When an overridden method is called by a reference, java determines which version of that method to execute based on the type of object it refer to.</span></div>
<div class="_oDd" data-hveid="74">
<div id="nmtbi12" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="80" data-ved="0ahUKEwiVsrL3kfjQAhWKK48KHfGeAnkQuk4IUCgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">Is overloading a form of polymorphism?</span></h3>
</div>
</div>
<div id="nmtbi12cntw" class="nmcw nmbl nmca" data-hveid="81" data-ved="0ahUKEwiVsrL3kfjQAhWKK48KHfGeAnkQu04IUSgB">
<div id="nmtbi12cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="82"><span class="_Tgc _y9e">The keyword in here is overriding, overloading is different and is not considered as polymorphism. with overloading you can define multiple methods "with same name" but with different parameters on same object or class. java doesn't truly offer this level of polymorphism (called also object slicing).</span></div>
<div class="_oDd" data-hveid="82">&nbsp;</div>
<div class="_oDd" data-hveid="82">In java language, polymorphism is essentially considered into two versions.</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ul>
<li style="padding-left: 30px;">Compile time polymorphism (static binding or method overloading)</li>
<li style="padding-left: 30px;">Runtime polymorphism (dynamic binding or method overriding)</li>
</ul>
<h4><span style="color: #000000;"><strong>Compile time polymorphism</strong></span></h4>
<p>The process of binding the overloaded method within object at compile time is known as Static polymorphism due to static polymorphism utilization of resources (main memory space) is poor because for each and every overloaded method a memory space is created at compile time when it binds with an object. In C++ environment the above problem can be solve by using dynamic polymorphism by implementing with virtual and pure virtual function so most of the C++ developer in real worlds follows only dynamic polymorphism.</p>
<h4><span style="color: #000000;"><strong>Dynamic polymorphism</strong></span></h4>
<p>In dynamic polymorphism method of the program binds with an object at runtime the advantage of dynamic polymorphism is allocating the memory space for the method (either for overloaded method or for override method) at run time.</p>
<h5><span style="color: #000000;"><strong>Example of Dynamic polymorphism.</strong></span></h5>
<p>In below example we create two class Person an Employee, Employee class extends Person class feature and override walk() method. We are calling the walk() method by the reference variable of Parent class. Since it refers to the subclass object and subclass method overrides the Parent class method, subclass method is invoked at runtime. Here method invocation is determined by the JVM not compiler, So it is known as runtime polymorphism.</p>
<pre class="prettyprint prettyprinted" style="padding-left: 30px;"><span class="kwd">class</span> <span class="typ">Person</span>
<span class="pun">{</span>
<span class="kwd">void</span><span class="pln"> walk</span><span class="pun">()</span>
<span class="pun">{</span>
<span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Can Run...."</span><span class="pun">);</span>
<span class="pun">}</span>
<span class="pun">}</span>
<span class="kwd">class</span> <span class="typ">Employee</span> <span class="kwd">extends</span> <span class="typ">Person</span>
<span class="pun">{</span>
<span class="kwd">void</span><span class="pln"> walk</span><span class="pun">()</span>
<span class="pun">{</span>
<span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Running Fast..."</span><span class="pun">);</span>
<span class="pun">}</span>
<span class="kwd">public</span> <span class="kwd">static</span> <span class="kwd">void</span><span class="pln"> main</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> arg</span><span class="pun">[])</span>
<span class="pun">{</span>
<span class="typ">Person</span><span class="pln"> p</span><span class="pun">=</span><span class="kwd">new</span> <span class="typ">Employee</span><span class="pun">();</span> <span class="com">//upcasting</span><span class="pln">
p</span><span class="pun">.</span><span class="pln">walk</span><span class="pun">();</span>
<span class="pun">}</span>
<span class="pun">}
</span></pre>
<h5 class="example"><span style="color: #000000;">Output</span></h5>
<pre class="code">Running fast...</pre>
<h3><span style="color: #000000;">How Polymorphism supported in Java</span></h3>
<p>Java has excellent support of polymorphism in terms of Inheritance, method overloading and method overriding. Method overriding allows Java to invoke method based on a particular object at run-time instead of declared type while coding. To get hold of concept let's see an example of polymorphism in Java:</p>
<pre style="padding-left: 30px;">public class TradingSystem{
&nbsp;&nbsp; public String getDescription(){
   return "electronic trading system";
&nbsp;&nbsp; }
}
public class DirectMarketAccessSystem extends TradingSystem{
&nbsp; public String getDescription(){
&nbsp;&nbsp;&nbsp;&nbsp; return "direct market access system";
&nbsp;&nbsp; }
}
public class CommodityTradingSystem extends TradingSystem{
&nbsp;&nbsp; public String getDescription(){
&nbsp;&nbsp;&nbsp;&nbsp; return "Futures trading system";
&nbsp;&nbsp; }
}</pre>
<h3><span style="color: #000000;">Where to use Polymorphism in code</span></h3>
<p>Probably this is the most important part of this Java Polymorphism tutorial and It&rsquo;s good to know <em>where you can use Polymorphism in Java </em>while writing code. Its common practice to always replace concrete implementation with interface it&rsquo;s not that easy and&nbsp; comes with practice but here are some common places where I check for polymorphism: <span style="color: #000000;"><strong>Method argument:</strong></span> Always use super type in method argument that will give you leverage to pass any implementation while invoking a method. For example:</p>
<pre style="padding-left: 30px;"><strong>public</strong> <strong>void</strong> showDescription(TradingSystem tradingSystem){
 tradingSystem.description();
}</pre>
<p>If you have used concrete implementation e.g. CommodityTradingSystem or DMATradingSystem then that code will require frequent changes whenever you add new Trading system. <span style="color: #000000;"><strong>Variable names:</strong></span> Always use Super type while you are storing reference returned from any <a href="http://javarevisited.blogspot.sg/2011/12/factory-design-pattern-java-example.html">Factory method in Java</a>, This gives you the flexibility to accommodate any new implementation from Factory. Here is an example of polymorphism while writing Java code which you can use retrieving reference from Factory:</p>
<pre style="padding-left: 30px;">String systemName = Configuration.getSystemName();
TradingSystem system = TradingSystemFactory.getSystem(systemName);</pre>
<p><span style="color: #000000;"><strong>Return type of method</strong></span> The return type of any method is another place where you should be using interface to take advantage of Polymorphism in Java. In fact, this is a requirement of <a href="http://javarevisited.blogspot.sg/2011/12/factory-design-pattern-java-example.html">Factory design pattern in Java</a> to use interface as a return type for factory method.</p>
<pre style="padding-left: 30px;">public TradingSystem getSystem(String name)
{
 //code to return appropriate implementation
&nbsp; }</pre>
<p><span style="color: #000000;"><strong>For indepth understanding of Java click on</strong></span></p>
<p style="padding-left: 30px;"><a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java Tutorials</a></p>
<p style="padding-left: 30px;"><a href="https://tekslate.com/java-virtual-machine-java/" target="_blank" rel="noopener">Java Virtual Machine</a></p>
<p style="padding-left: 30px;"><a href="https://tekslate.com/java-multithreading-in-java/" target="_blank" rel="noopener">Multi threading in java</a></p>
<p style="padding-left: 30px;"><a href="https://tekslate.com/exception-handling-in-java/" target="_blank" rel="noopener">Exception Handling in Java</a></p>
<p style="padding-left: 30px;"><a href="https://tekslate.com/java-interface-in-java/" target="_blank" rel="noopener">Interface in Java</a></p>33:T3224,<h2 class="ibm-h2"><span style="color: #000000;">Inheritance in Java</span></h2>
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="30"><span class="_Tgc">Inheritance in java is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea behind inheritance in java is that you can create new classes that are built upon existing classes.</span></div>
</div>
<h3 class="ibm-h2"><span style="color: #000000;">How inheritance works</span></h3>
<p style="text-align: justify;">Classes in Java code exist in hierarchies. Classes above a given class in a hierarchy are <em>superclasses</em> of that class. That particular class is a <em>subclass</em> of every class higher up the hierarchy. A subclass inherits from its superclasses. The <code>java.lang.Object</code> class is at the top of the class hierarchy &mdash; so every Java class is a subclass of, and inherits from, <code>Object</code>.</p>
<p style="text-align: justify;">For example, suppose you have a <code>Person</code> class that looks like the one in Listing 1.</p>
<h5 id="listing1" class="ibm-h5">Listing 1. Public <code>Person</code> class</h5>
<div class="ibm-syntax-container">
<div id="highlighter_674751" class="syntaxhighlighter nogutter htmlscript">
<pre style="padding-left: 30px;">public class Person {
&nbsp;&nbsp;public static final String STATE_DELIMITER = "~";
&nbsp;&nbsp;public Person() {
&nbsp;&nbsp;&nbsp;&nbsp;// Default constructor
&nbsp;&nbsp;}
&nbsp;&nbsp;public enum Gender {
&nbsp;&nbsp;&nbsp;&nbsp;MALE,
&nbsp;&nbsp;&nbsp;&nbsp;FEMALE,
&nbsp;&nbsp;&nbsp;UNKNOWN
&nbsp;}
&nbsp;&nbsp;public Person(String name, int age, int height, int weight, String eyeColor, Gender gender) {
 this.name = name;
&nbsp;&nbsp;&nbsp;&nbsp;this.age = age;
&nbsp;&nbsp;&nbsp;&nbsp;this.height = height;
&nbsp;&nbsp;&nbsp;&nbsp;this.weight = weight;
&nbsp;&nbsp;&nbsp;&nbsp;this.eyeColor = eyeColor;
&nbsp;&nbsp;&nbsp;&nbsp;this.gender = gender;
&nbsp;&nbsp;}
&nbsp;private String name;
&nbsp;private int age;
&nbsp;private int height;
&nbsp;private int weight;
&nbsp;private String eyeColor;
&nbsp;private Gender gender;</pre>
<p style="text-align: justify;">The <code>Person</code> class in Listing 1 implicitly inherits from <code>Object</code>. Because inheriting from <code>Object</code> is assumed for every class, you don't need to type <code>extends Object</code> for every class you define. But what does it mean to say that a class inherits from its superclass? It simply means that <code>Person</code> has access to the exposed variables and methods in its superclasses. In this case, <code>Person</code> can see and use <code>Object</code>'s public and protected methods and variables.</p>
<h2 class="h2"><span style="color: #000000;">Why multiple inheritance is not supported in java?</span></h2>
To reduce the complexity and simplify the language, multiple inheritance is not supported in java. Consider a scenario where A, B and C are three classes. The C class inherits A and B classes. If A and B classes have same method and you call it from child class object, there will be ambiguity to call method of A or B class. Since compile time errors are better than runtime errors, java renders compile time error if you inherit 2 classes. So whether you have same method or different, there will be compile time error now.
<div class="codeblock">
<div class="dp-highlighter">
<div class="bar">
<pre style="padding-left: 30px;"><span class="keyword">class</span>&nbsp;A{&nbsp;&nbsp;
<span class="keyword">void</span>&nbsp;msg(){System.out.println(<span class="string">"Hello"</span>);}&nbsp;&nbsp;
}&nbsp;&nbsp;
<span class="keyword">class</span>&nbsp;B{&nbsp;&nbsp;
<span class="keyword">void</span>&nbsp;msg(){System.out.println(<span class="string">"Welcome"</span>);}</pre>
<pre style="padding-left: 30px;">}&nbsp;&nbsp;
<span class="keyword">class</span>&nbsp;C&nbsp;<span class="keyword">extends</span>&nbsp;A,B{<span class="comment">//suppose&nbsp;if&nbsp;it&nbsp;were</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;Public&nbsp;Static&nbsp;<span class="keyword">void</span>&nbsp;main(String&nbsp;args[]){&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;C&nbsp;obj=<span class="keyword">new</span>&nbsp;C();&nbsp;&nbsp;
&nbsp;&nbsp;obj.msg();<span class="comment">//Now&nbsp;which&nbsp;msg()&nbsp;method&nbsp;would&nbsp;be&nbsp;invoked?</span>&nbsp;&nbsp;
}&nbsp;&nbsp;
}</pre>
</div>
</div>
</div>
<div id="nmtbi14" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="101" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQuk4IZSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is inheritance in object oriented programming?</span></h3>
</div>
</div>
<div id="nmtbi14cntw" class="nmcw nmbl nmca" data-hveid="102" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQu04IZigB">
<div id="nmtbi14cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="103"><span class="_Tgc _y9e">Inheritance (OOP) is when an object or class is based on another object (prototypal inheritance) or class (class-based inheritance), using the same implementation (inheriting from an object or class) specifying implementation to maintain the same behavior (realizing an interface; inheriting behavior).</span></div>
<div class="_oDd" data-hveid="103">
<div id="nmtbi16" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="109" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQuk4IbSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is meant by multiple inheritance?</span></h3>
</div>
</div>
<div id="nmtbi16cntw" class="nmcw nmbl nmca" data-hveid="110" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQu04IbigB">
<div id="nmtbi16cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="111"><span class="_Tgc _y9e">Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit characteristics and features from more than one parent object or parent class.</span></div>
<div class="_oDd" data-hveid="111">
<div id="nmtbi9" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="69" data-ved="0ahUKEwjF2cfNsfrQAhWKMo8KHc2gAS8Quk4IRSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is the single inheritance?</span></h3>
</div>
</div>
<div id="nmtbi9cntw" class="nmcw nmbl nmca" data-hveid="70" data-ved="0ahUKEwjF2cfNsfrQAhWKMo8KHc2gAS8Qu04IRigB">
<div id="nmtbi9cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<p class="_oDd" data-hveid="71"><span class="_Tgc _y9e">Single inheritance enables a derived class to inherit properties and behavior from a single parent class. It allows a derived class to inherit the properties and behavior of a base class, thus enabling code reusability as well as adding new features to the existing code.</span></p>
<div id="nmtbi20cntw" class="nmcw nmbl nmca" data-hveid="126" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQu04IfigB">
<div id="nmtbi20cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="127">
<div id="nmtbi18" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="117" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQuk4IdSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What Is syntax in Java?</span></h3>
</div>
</div>
<div id="nmtbi18cntw" class="nmcw nmbl nmca" data-hveid="118" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQu04IdigB">
<div id="nmtbi18cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<p class="_oDd" data-hveid="119"><span class="_Tgc _y9e">The syntax is mostly derived from C and <a href="https://tekslate.com/data-types-c-plus-plus/" target="_blank" rel="noopener">C++</a>. Unlike C++, Java is almost exclusively an object-oriented language. There are no global functions or variables, but there are data members which are also regarded as <a href="https://en.wikipedia.org/wiki/Global_variable" target="_blank" rel="noopener">global variables</a>. all code belongs to classes and all values are objects.</span></p>
<div id="nmtbi20" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="125" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQuk4IfSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is class inheritance?</span></h3>
</div>
</div>
<div id="nmtbi20cntw" class="nmcw nmbl nmca" data-hveid="126" data-ved="0ahUKEwjPwrTksfrQAhWKqo8KHRE8CIcQu04IfigB">
<div id="nmtbi20cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="127"><span class="_Tgc _y9e">In object-oriented programming, inheritance enables new objects to take on the properties of existing objects. A class that is used as the basis for inheritance is called a superclass or base class. A class that inherits from a superclass is called a subclass or derived class.</span></div>
</div>
</div>
</div>
</div>
<div id="nmtbi13" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="85" data-ved="0ahUKEwjF2cfNsfrQAhWKMo8KHc2gAS8Quk4IVSgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">Can private classes be inherited in Java?</span></h3>
</div>
</div>
<div id="nmtbi13cntw" class="nmcw nmbl nmca" data-hveid="86" data-ved="0ahUKEwjF2cfNsfrQAhWKMo8KHc2gAS8Qu04IVigB">
<div id="nmtbi13cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="87"><span class="_Tgc _y9e">A subclass does not inherit the private members of its parent class. However, if the superclass has public or protected methods for accessing its private fields, these can also be used by the subclass. A nested class has access to all theprivate members of its enclosing class&mdash;both fields and methods.</span></div>
</div>
<div class="g">&nbsp;</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<h2 id="N100A9" class="ibm-h3"><span style="color: #000000;">class hierarchy</span></h2>
Now suppose you have an <code>Employee</code> class that inherits from <code>Person</code>. <code>Employee</code>'s class definition would look something like this:
<div class="ibm-syntax-container">
<div id="highlighter_944416" class="syntaxhighlighter nogutter htmlscript">
<pre style="padding-left: 30px;">public class Employee extends Person {
 private String taxpayerIdentificationNumber;
&nbsp;private String employeeNumber;
&nbsp;private BigDecimal salary;</pre>
<pre style="padding-left: 30px;">&nbsp;&nbsp;// . . .
}</pre>
<p style="text-align: justify;">The <code>Employee</code> inheritance relationship to all of its superclasses (its <em>inheritance graph</em>) implies that <code>Employee</code> has access to all public and protected variables and methods in <code>Person</code> (because <code>Employee</code> directly extends <code>Person</code>), as well as those in <code>Object</code> (because <code>Employee</code> actually extends <code>Object</code>, too, though indirectly). However, because <code>Employee</code> and <code>Person</code> are in the same package, <code>Employee</code> also has access to the <em>package-private</em> (sometimes called <em>friendly</em>) variables and methods in <code>Person</code>.</p>
<p style="text-align: justify;">To go one step deeper into the class hierarchy, you could create a third class that extends <code>Employee</code>:</p>
<pre>public class Manager extends Employee {
&nbsp;// . . .
}</pre>
In the Java language, any class can have at most one direct superclass, but a class can have any number of subclasses. That's the most important thing to remember about inheritance hierarchy in the Java language.
<h3 id="N100F6" class="ibm-h3"><span style="color: #000000;">Single versus multiple inheritance</span></h3>
Languages like C++ support the concept of <em>multiple inheritance</em>: At any point in the hierarchy, a class can directly inherit from one or more classes. The Java language supports only <em>single inheritance</em>&mdash; meaning you can only use the <code>extends</code> keyword with a single class. So the class hierarchy for any Java class always consists of a straight line all the way up to <code>java.lang.Object</code>. <strong>For indepth understanding of java click on</strong> <a href="https://tekslate.com/java-interface-in-java/" target="_blank" rel="noopener">Interface in java</a> <a href="https://tekslate.com/polymorphism-in-java/" target="_blank" rel="noopener">Polymorphism in Java</a> <a href="https://tekslate.com/exception-handling-in-java/" target="_blank" rel="noopener">Exception Handling in java</a> <a href="https://tekslate.com/java-multithreading-in-java/" target="_blank" rel="noopener">Multithreading in java</a> <a href="https://tekslate.com/java-virtual-machine-java/" target="_blank" rel="noopener">Java Virtual Machine</a></div>
</div>
</div>
</div>34:T27d8,<h2><span style="color: #000000;">What is Constructors in Java</span></h2>
<p>Java constructors are the methods which are used to initialize objects. Constructor method has the same name as that of class, they are called or invoked when an object of class is created and can't be called explicitly. Attributes of an object may be available when creating objects if no attribute is available then default constructor is called, also some of the attributes may be known initially. It is optional to write constructor method in a class but due to their utility they are used.</p>
<h4><strong>Java constructor example</strong></h4>
<div class="geshifilter">
<pre class="java geshifilter-java">class Programming {
  //constructor method
  Programming() {
    System.out.println("Constructor method called.");
  }
  public static void main(String[] args) {
    Programming object = new Programming(); //creating object
  }
}

Output of program:
<img class="aligncenter" title="Constructors in Java-Java constructor example" src="http://www.programmingsimplified.com/images/java/constructor-java.png" alt="Constructors in Java" width="317" height="171" /></pre>
<h3 class="java geshifilter-java"><strong>Types of Constructors</strong></h3>
<p class="java geshifilter-java">There are three types of constructors:</p>
<ul>
<li>default,</li>
<li>no-arg</li>
<li>parameterised.</li>
</ul>
<p style="text-align: center;">[button url="http://tekslate.com/tutorials/java-tutorials/" class="other" bg="" hover_bg="" size="0px" color="#eeebeb" radius="0px" width="0px" height="0px" target="_self"] Java Tutorials [/button]</p>
<div id="nmtbi15" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="107" data-ved="0ahUKEwiMwt-mz_rQAhULKY8KHbYDDmIQuk4IaygA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is the default constructor?</span></h3>
</div>
</div>
<div id="nmtbi15cntw" class="nmcw nmbl nmca" data-hveid="108" data-ved="0ahUKEwiMwt-mz_rQAhULKY8KHbYDDmIQu04IbCgB">
<div id="nmtbi15cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<p class="_oDd" data-hveid="109"><span class="_Tgc _y9e">A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values. If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a constructor A::A(). This constructor is an inline public member of its class</span></p>
<strong>Default constructor:</strong> If you do not define any constructor in your class, java generates one for you by default. This constructor is known as default constructor. You would not find it in your source code but it would present there. It would look like this if you could see it. Default constructor for class Demo:
<pre class="prettyprint prettyprinted" style="padding-left: 30px;"><span class="kwd">public</span> <span class="typ">Demo</span><span class="pun">()</span>
<span class="pun">{</span>
<span class="pun">}</span></pre>
<strong>no-arg constructor:</strong> Constructor with no arguments is known as no-arg constructor. The signature is same as default constructor, however body can have any code unlike default constructor where the body does nothing.
<div id="nmtbi17" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="115" data-ved="0ahUKEwiMwt-mz_rQAhULKY8KHbYDDmIQuk4IcygA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is the use of parameterized constructor?</span></h3>
</div>
</div>
<div id="nmtbi17cntw" class="nmcw nmbl nmca" data-hveid="116" data-ved="0ahUKEwiMwt-mz_rQAhULKY8KHbYDDmIQu04IdCgB">
<div id="nmtbi17cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="117"><span class="_Tgc _y9e">When an object is declared in a <a href="https://en.wikipedia.org/wiki/Constructor_(object-oriented_programming)" target="_blank" rel="noopener">parameterized constructor</a>, the initial values have to be passed as arguments to the constructor function. The normal way of object declaration may not work. The constructors can be called explicitly or implicitly.</span></div>
</div>
<div class="_oDd" data-hveid="117">
<h2><span style="color: #000000;">Constructor Overloading - Multiple Constructors for a Java Class</span></h2>
A class can have multiple constructors, as long as their signature (the parameters they take) are not the same. You can define as many constructors as you need. When a Java class contains multiple constructors, we say that the constructor is overloaded (comes in multiple versions). <strong>Java constructor overloading example:</strong>
<pre class="codeBox" style="padding-left: 30px;">public class MyClass {
    private int number = 0;
    public MyClass() {
    }
public MyClass(int theNumber) {
        this.number = theNumber;
  }
}
</pre>
The Java class above contains two constructors. The first constructor is a no-arg constructor, meaning it takes no parameters (no arguments). The second constructor takes an <code>int</code> parameter. Inside the constructor body the <code>int</code> parameter value is assigned to a field, meaning the value of the parameter is copied into the field. The field is thus initialized to the given parameter value. The keyword <code>this</code> in front of the field name (<code>this.number</code>) is not necessary. It just signals to the compiler that it is the field named <code>number</code> that is being referred to. This is explained in more detail in the section about constructor parameters.</div>
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="117">
<div class="row">
<div class="col-sm-7 article-title">
<h2><span style="color: #000000;">How to Use A Constructor In Java</span></h2>
</div>
</div>
A constructor<em> </em>in Java is a block of code similar to a method that&rsquo;s called when an instance of an object is created. Here are the key differences between a constructor and a method:
<ul class="level-one">
<li>
<p class="first-para">A constructor doesn&rsquo;t have a return type.</p>
</li>
<li>
<p class="first-para">The name of the constructor must be the same as the name of the class.</p>
</li>
<li>
<p class="first-para">Unlike methods, constructors are not considered members of a class.</p>
</li>
<li>
<p class="first-para">A constructor is called automatically when a new instance of an object is created.</p>
</li>
</ul>
Here&rsquo;s the basic format for coding a constructor:
<pre class="code" style="padding-left: 30px;">public ClassName (parameter-list) [throws exception...]
{
    statements...
}</pre>
The <span class="code">public</span> keyword indicates that other classes can access the constructor. <span class="code">ClassName</span> must be the same as the name of the class that contains the constructor. You code the parameter list the same way that you code it for a method. Notice also that a constructor can throw exceptions if it encounters situations that it can&rsquo;t recover from. A constructor allows you to provide initial values for class fields when you create the object. Suppose that you have a class named <span class="code">Actor</span> that has fields named <span class="code">firstName</span> and <span class="code">lastName</span>. You can create a constructor for the <span class="code">Actor</span> class:
<pre class="code" style="padding-left: 30px;">public Actor(String first, String last)
{
    firstName = first;
    lastName = last;
}</pre>
Then you create an instance of the <span class="code">Actor</span> class by calling this constructor:
<pre class="code" style="padding-left: 30px;">Actor a = new Actor("Arnold", " Schwarzenegger");</pre>
A new <span class="code">Actor</span> object for Arnold Schwarzenegger is created. Like methods, constructors can be overloaded. In other words, you can provide more than one constructor for a class if each constructor has a unique signature. Here&rsquo;s another constructor for the <span class="code">Actor</span> class:
<pre class="code" style="padding-left: 30px;">public Actor(String first, String last, boolean good)
{
    firstName = first;
    lastName = last;
    goodActor = good;
}</pre>
This constructor lets you create an <span class="code">Actor</span> object with information besides the actor&rsquo;s name:
<pre class="code" style="padding-left: 30px;">Actor a = new Actor("Arnold", "Schwarzenegger", false);</pre>
If you do not provide a constructor for a class, Java will automatically create a <em>default constructor</em> that has no parameters and doesn&rsquo;t initialize any fields. This default constructor is called if you specify the <span class="code">new</span> keyword without passing parameters. For example:
<pre class="code" style="padding-left: 30px;">Ball b = new Ball();</pre>
Here, a variable of type <span class="code">Ball</span> is created by using the default constructor for the <span class="code">Ball</span> class. If you explicitly declare any constructors for a class, Java does <em>not </em>create a default constructor for the class. As a result, if you declare a constructor that accepts parameters and still want to have an empty constructor (with no parameters and no body), you must explicitly declare an empty constructor for the class.</div>
<div class="_oDd" data-hveid="117">
<div class="ad x2">&nbsp;</div>
<div class="ad x2">&nbsp;<strong>For&nbsp;indepth understanding &nbsp;of Java click on</strong></div>
<a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java Tutoria</a></div>
<div class="_oDd" data-hveid="117"><a href="https://tekslate.com/java-inheritance-in-java/" target="_blank" rel="noopener">Inheritance in Java</a></div>
<div class="_oDd" data-hveid="117"><a href="https://tekslate.com/polymorphism-in-java/" target="_blank" rel="noopener">Polymorphism in Java</a></div>
<div class="_oDd" data-hveid="117"><a href="https://tekslate.com/java-virtual-machine-java/" target="_blank" rel="noopener">Java Virtual Machine&nbsp;</a></div>
<div class="_oDd" data-hveid="117"><a href="https://tekslate.com/exception-handling-in-java/" target="_blank" rel="noopener">Exception Handnlig in java</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>35:T3d76,<h2><span style="color: #000000;">Java Annotations in Java</span></h2>
<p style="text-align: justify;">Annotation is code about the code, that is metadata about the program itself. In other words, organized data about the code, embedded within the code itself. It can be parsed by the compiler, annotation processing tools and can also be made available at run-time too.</p>
<p style="text-align: justify;">We have basic java comments infrastructure using which we add information about the code / logic so that in future, another programmer or the same programmer can understand the code in a better way.<a href="https://en.wikipedia.org/wiki/Javadoc" target="_blank" rel="noopener"> Javadoc</a> is an additional step over it, where we add information about the class, methods, variables in the source code. The way we need to add is organized using a syntax. Therefore, we can use a tool and parse those comments and prepare a javadoc document which can be distributed separately.</p>
<p style="text-align: justify;">Javadoc facility gives option for understanding the code in an external way, instead of opening the code the javadoc document can be used separately. <a href="https://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank" rel="noopener">IDE benefits</a> using this javadoc as it is able to render information about the code as we develop.</p>
<h3><span style="color: #000000;">Annotation Types</span></h3>
<p style="text-align: justify;"><strong>Documented</strong></p>
<p style="padding-left: 30px; text-align: justify;">When a annotation type is annotated with @Documented then wherever this annotation is used those elements should be documented using Javadoc tool.</p>
<p style="text-align: justify;"><strong>Inherited</strong></p>
<p style="padding-left: 30px; text-align: justify;">This meta annotation denotes that the annotation type can be inherited from super class. When a class is annotated with annotation of type that is annotated with Inherited, then its super class will be queried till a matching annotation is found.</p>
<p style="text-align: justify;"><strong>Retention</strong></p>
<p style="padding-left: 30px; text-align: justify;">This meta annotation denotes the level till which this annotation will be carried. When an annotation type is annotated with meta annotation Retention, RetentionPolicy has three possible values:</p>
<pre class="prettyprint lang-java prettyprinted" style="padding-left: 60px;"><span class="lit">@Retention</span><span class="pun">(</span><span class="typ">RetentionPolicy</span><span class="pun">.</span><span class="pln">RUNTIME</span><span class="pun">)</span>
<span class="kwd">public</span> <span class="lit">@interface</span> <span class="typ">Developer</span> <span class="pun">{</span>
	<span class="typ">String</span><span class="pln"> value</span><span class="pun">();</span>
<span class="pun">}</span></pre>
<p style="padding-left: 30px; text-align: justify;"><strong>Class</strong> When the annotation value is given as &lsquo;class&rsquo; then this annotation will be compiled and included in the class file.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Runtime</strong> The value name itself says, when the retention value is &lsquo;Runtime&rsquo; this annotation will be available in JVM at runtime. We can write custom code using reflection package and parse the annotation. I have give an example below.</p>
<p style="padding-left: 30px; text-align: justify;"><strong>Source </strong>This annotation will be removed at compile time and will not be available at compiled class.</p>
<p style="text-align: justify;"><strong>Target</strong></p>
<p style="text-align: justify;">This meta annotation says that this annotation type is applicable for only the element (ElementType) listed. Possible values for ElementType are, CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE.</p>
<pre class="prettyprint lang-java prettyprinted" style="padding-left: 30px;"><span class="lit">@Target</span><span class="pun">(</span><span class="typ">ElementType</span><span class="pun">.</span><span class="pln">FIELD</span><span class="pun">)</span>
<span class="kwd">public</span> <span class="lit">@interface</span> <span class="typ">FieldInfo</span> <span class="pun">{</span> <span class="pun">}

</span></pre>
<h2><span style="color: #000000;">Creating Your Own Annotations</span></h2>
<p style="text-align: justify;">It is possible to create your own (custom) Java annotations. Annotations are defined in their own file, just like a Java class or interface. Here is custom Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">@interface MyAnnotation {
    String   value();
    String   name();
    int      age();
    String[] newNames();
}
</pre>
<p style="text-align: justify;">This example defines an annotation called <code>MyAnnotation</code> which has four elements. Notice the <code>@interface</code>keyword. This signals to the Java compiler that this is a Java annotation definition.</p>
<p>Notice that each element is defined similarly to a method definition in an interface. It has a data type and a name. You can use all primitive data types as element data types. You can also use arrays as data type. You cannot use complex objects as data type. To use the above annotation, you could use code like this:</p>
<pre class="codeBox" style="padding-left: 30px;">@MyAnnotation(
    value="123",
    name="Jakob",
    age=37,
    newNames={"Jenkov", "Peterson"}
)
public class MyClass {
}
</pre>
<p>As you can see, I have to specify values for all elements of the <code>MyAnnotation</code> annotation.</p>
<h3><span style="color: #000000;">Element Default Values</span></h3>
<p style="text-align: justify;">You can specify default values for an element. That way the element becomes optional and can be left out. Here is an example of how the annotation definition looks with a default value for an element:</p>
<pre class="codeBox" style="padding-left: 30px;">@interface MyAnnotation {
    String   value() default "";
    String   name();
    int      age();
    String[] newNames();
}
</pre>
<p style="text-align: justify;">The <code>value</code> element can now be left out when using the annotation. If you leave it out, it will be considered as if you had used the default value for the <code>value</code> element. Here is an example of an annotation with an element value left out, so that element is set to the default value:</p>
<pre class="codeBox" style="padding-left: 30px;">@MyAnnotation(
    name="Jakob",
    age=37,
    newNames={"Jenkov", "Peterson"}
)
public class MyClass {
}
</pre>
<p style="text-align: justify;">Notice that the <code>value</code> element is no longer present.</p>
<h3><span style="color: #000000;">@Retention</span></h3>
<p style="text-align: justify;">You can specify for your custom annotation if it should be available at runtime, for inspection via reflection. You do so by annotating your annotation definition with the <code>@Retention</code> annotation. Here is how that is done:</p>
<pre class="codeBox" style="padding-left: 30px;">import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
@interface MyAnnotation {
    String   value() default "";
}
</pre>
<p style="text-align: justify;">Notice the <code>@Retention</code> annotation added above the <code>MyAnnotation</code> definition:</p>
<pre class="codeBox">@Retention(RetentionPolicy.RUNTIME)
</pre>
<p style="text-align: justify;">The <code>RetentionPolicy</code> class contains two more values you can use:</p>
<p style="text-align: justify;"><code>RetentionPolicy.CLASS</code> means that the annotation is stored in the .class file, but not available at runtime. This is the default retention policy, if you do not specify any retention policy at all.</p>
<p style="text-align: justify;"><code>RetentionPolicy.SOURCE</code> means that the annotation is only available in the source code, and not in the .class files and not a runtime. If you create your own annotations for use with build tools that scan the code, you can use this retention policy. That way the .class files are not polluted unnecessarily.</p>
<h3 style="text-align: justify;"><span style="color: #000000;">@Target</span></h3>
<p style="text-align: justify;">You can specify which Java elements your custom annotation can be used to annotate. You do so by annotating your annotation definition with the <code>@Target</code> annotation. Here is a <code>@Target</code> Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target({ElementType.METHOD})
public @interface MyAnnotation {
    String   value();
}
</pre>
<p style="text-align: justify;">This example shows a Java annotation that can only be used to annotate methods.</p>
<p style="text-align: justify;">The <code>ElementType</code> class contains the following possible targets:</p>
<ul>
<li style="text-align: justify;">ElementType.ANNOTATION_TYPE</li>
<li style="text-align: justify;">ElementType.CONSTRUCTOR</li>
<li style="text-align: justify;">ElementType.FIELD</li>
<li style="text-align: justify;">ElementType.LOCAL_VARIABLE</li>
<li style="text-align: justify;">ElementType.METHOD</li>
<li style="text-align: justify;">ElementType.PACKAGE</li>
<li style="text-align: justify;">ElementType.PARAMETER</li>
<li style="text-align: justify;">ElementType.TYPE</li>
</ul>
<p style="text-align: justify;">Most of these are self explaining, but a few are not. Therefore I will explain the targets which are not obvious.</p>
<p style="text-align: justify;">The <code>ANNOTATION_TYPE</code> target means Java annotation definitions. Thus, the annotation can only be used to annotate other annotations. Like the <code>@Target</code> and <code>@Retention</code> annotations.</p>
<p style="text-align: justify;">The <code>TYPE</code> target means any type. A type is either a class, interface, enum or annotation.</p>
<h3><span style="color: #000000;">@Inherited</span></h3>
<p style="text-align: justify;">The <code>@Inherited</code> annotation signals that a custom Java annotation used in a class should be inherited by subclasses inheriting from that class. Here is an <code>@Inherited</code> Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">java.lang.annotation.Inherited
@Inherited
public @interface MyAnnotation {
}
@MyAnnotation
public class MySuperClass { ... }
public class MySubClass extends MySuperClass { ... }
</pre>
<p style="text-align: justify;">In this example the class <code>MySubClass</code> inherits the annotation <code>@MyAnnotation</code> because <code>MySubClass</code> inherits from <code>MySuperClass</code>, and <code>MySuperClass</code> has a <code>@MyAnnotation</code> annotation.</p>
<h3 style="text-align: justify;"><span style="color: #000000;">@Documented</span></h3>
<p style="text-align: justify;">The <code>@Documented</code> annotation is used to signal to the JavaDoc tool that your custom annotation should be visible in the JavaDoc for classes using your custom annotation. Here is a <code>@Documented</code> Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">import java.lang.annotation.Documented;
@Documented
public @interface MyAnnotation {
}
@MyAnnotation
public class MySuperClass { ... }
</pre>
<p style="text-align: justify;">When generating JavaDoc for the <code>MySuperClass</code> class, the <code>@MyAnnotation</code> is now included in the JavaDoc.</p>
<p style="text-align: justify;">You will not use the <code>@Documented</code> annotation often, but now you know it exists, if you should need it.</p>
<h2 style="text-align: justify;"><span style="color: #000000;">Built-in Java Annotations</span></h2>
<p style="text-align: justify;">Java comes with three built-in annotations which are used to give the Java compiler instructions. These annotations are:</p>
<ul style="text-align: justify;">
<li>@Deprecated</li>
<li>@Override</li>
<li>@SuppressWarnings</li>
</ul>
<p style="text-align: justify;">Each of these annotations are explained in the following sections.</p>
<h3 style="text-align: justify;"><span style="color: #000000;">@Deprecated</span></h3>
<p style="text-align: justify;">The <code>@Deprecated</code> annotation is used to mark a class, method or field as deprecated, meaning it should no longer be used. If your code uses deprecated classes, methods or fields, the compiler will give you a warning. Here is <code>@Deprecated</code> Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">@Deprecated
public class MyComponent {
}
</pre>
<p style="text-align: justify;">The use of the <code>@Deprecated</code> Java annotation above the class declaration marks the class as deprecated.</p>
<p style="text-align: justify;">You can also use the <code>@Deprecated</code> annotation above method and field declarations, to mark the method or field as deprecated.</p>
<p style="text-align: justify;">When you use the <code>@Deprecated</code> annotation, it is a good idea to also use the corresponding <code>@deprecated</code>JavaDoc symbol, and explain why the class, method or field is deprecated, and what the programmer should use instead. For instance:</p>
<pre class="codeBox" style="padding-left: 30px;">@Deprecated
/**
  @deprecated Use MyNewComponent instead.
*/
public class MyComponent {
}
</pre>
<h3 style="text-align: justify;"><span style="color: #000000;">@Override</span></h3>
<p style="text-align: justify;">The <code>@Override</code> Java annotation is used above methods that override methods in a superclass. If the method does not match a method in the superclass, the compiler will give you an error.</p>
<p style="text-align: justify;">The <code>@Override</code> annotation is not necessary in order to override a method in a superclass. It is a good idea to use it still, though. In case someone changed the name of the overridden method in the superclass, your subclass method would no longer override it. Without the <code>@Override</code> annotation you would not find out. With the <code>@Override</code> annotation the compiler would tell you that the method in the subclass is not overriding any method in the superclass.</p>
<p style="text-align: justify;">Here is an <code>@Override</code> Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">public class MySuperClass {
    public void doTheThing() {
        System.out.println("Do the thing");
    }
}
public class MySubClass extends MySuperClass{

    @Override
    public void doTheThing() {
        System.out.println("Do it differently");
    }
}
</pre>
<p style="text-align: justify;">In case the method <code>doTheThing()</code> in <code>MySuperClass</code> changes signature so that the same method in the subclass no longer overrides it, the compiler will generate an error.</p>
<h3 style="text-align: justify;"><span style="color: #000000;">@SuppressWarnings</span></h3>
<p style="text-align: justify;">The <code>@SuppressWarnings</code> annotation makes the compiler suppress warnings for a given method. For instance, if a method calls a deprecated method, or makes an insecure type cast, the compiler may generate a warning. You can suppress these warnings by annotating the method containing the code with the <code>@SuppressWarnings</code> annotation.</p>
<p style="text-align: justify;">Here is a <code>@SuppressWarnings</code> Java annotation example:</p>
<pre class="codeBox" style="padding-left: 30px;">@SuppressWarnings
public void methodWithWarning() {
}
</pre>
<p style="text-align: justify;">&nbsp;</p>36:T352a,<h2><span style="color: #000000;">Encapsulation in java</span></h2>
<p>Encapsulation<span style="font-weight: 400;"> is a process of wrapping of data and methods in a single unit is called encapsulation. Encapsulation is achieved in java language by class concept.Combining of state and behavior in a single container is known as encapsulation. In java language encapsulation can be achieve using </span><a href="https://en.wikipedia.org/wiki/Class_(computer_programming)" target="_blank" rel="noopener">class</a><span style="font-weight: 400;"><a href="https://en.wikipedia.org/wiki/Class_(computer_programming)" target="_blank" rel="noopener"> keyword</a>, state represents declaration of variables on attributes and behavior represents operations in terms of method.</span> <strong>Example:</strong></p>
<div>
<div class="kix-page kix-page-paginated">
<div class="kix-page-content-wrapper">
<div class="kix-page-column">
<div id="" class="kix-paragraphrenderer">
<div class="kix-lineview">
<pre class="kix-lineview-content" style="padding-left: 30px;"><span class="goog-inline-block kix-lineview-text-block"><span class="kix-wordhtmlgenerator-word-node">class​</span><span class="kix-wordhtmlgenerator-word-node">​ ​Employee​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span></span>private​<span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">int​</span><span class="kix-wordhtmlgenerator-word-node">​ ​employeeId​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">private​</span><span class="kix-wordhtmlgenerator-word-node">​ ​String​ ​employeeName​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">private​</span><span class="kix-wordhtmlgenerator-word-node">​ ​String​ ​designation​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">public​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">int​</span><span class="kix-wordhtmlgenerator-word-node">​ ​getEmployeeId​</span><span class="kix-wordhtmlgenerator-word-node">()​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">return​</span><span class="kix-wordhtmlgenerator-word-node">​ ​employeeId​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span><span class="kix-wordhtmlgenerator-word-node">​</span><span class="kix-wordhtmlgenerator-word-node">}</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;</span></span>&nbsp;&nbsp;
<span class="kix-wordhtmlgenerator-word-node">​</span><span class="kix-wordhtmlgenerator-word-node">public​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">void​</span><span class="kix-wordhtmlgenerator-word-node">​ ​setEmployeeId​</span><span class="kix-wordhtmlgenerator-word-node">(​</span><span class="kix-wordhtmlgenerator-word-node">int​</span><span class="kix-wordhtmlgenerator-word-node">​ ​employeeId​</span><span class="kix-wordhtmlgenerator-word-node">)​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;</span></span>&nbsp;
​<span class="kix-wordhtmlgenerator-word-node">this​</span><span class="kix-wordhtmlgenerator-word-node">.​</span><span class="kix-wordhtmlgenerator-word-node">employeeId​ ​​</span><span class="kix-wordhtmlgenerator-word-node">=​</span><span class="kix-wordhtmlgenerator-word-node">​ ​employeeId​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">}</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">public​</span><span class="kix-wordhtmlgenerator-word-node">​ ​String​ ​getEmployeeName​</span><span class="kix-wordhtmlgenerator-word-node">()​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">return​</span><span class="kix-wordhtmlgenerator-word-node">​ ​employeeName​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">}</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">public​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">void​</span><span class="kix-wordhtmlgenerator-word-node">​ ​setEmployeeName​</span><span class="kix-wordhtmlgenerator-word-node">(​</span><span class="kix-wordhtmlgenerator-word-node">String​ ​employeeName​</span><span class="kix-wordhtmlgenerator-word-node">)​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span><span class="kix-wordhtmlgenerator-word-node">​</span><span class="kix-wordhtmlgenerator-word-node">this​</span><span class="kix-wordhtmlgenerator-word-node">.​</span><span class="kix-wordhtmlgenerator-word-node">employeeName​ ​​</span><span class="kix-wordhtmlgenerator-word-node">=​</span><span class="kix-wordhtmlgenerator-word-node">​ ​employeeName​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;</span></span>&nbsp;
<span class="kix-wordhtmlgenerator-word-node">​</span><span class="kix-wordhtmlgenerator-word-node">}</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;</span></span>&nbsp;&nbsp;
​<span class="kix-wordhtmlgenerator-word-node">public​</span><span class="kix-wordhtmlgenerator-word-node">​ ​String​ ​getDesignation​</span><span class="kix-wordhtmlgenerator-word-node">()​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">return​</span><span class="kix-wordhtmlgenerator-word-node">​ ​designation​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">}</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">public​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">void​</span><span class="kix-wordhtmlgenerator-word-node">​ ​setDesignation​</span><span class="kix-wordhtmlgenerator-word-node">(​</span><span class="kix-wordhtmlgenerator-word-node">String​ ​designation​</span><span class="kix-wordhtmlgenerator-word-node">)​</span><span class="kix-wordhtmlgenerator-word-node">​ ​​</span><span class="kix-wordhtmlgenerator-word-node">{</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span>​<span class="kix-wordhtmlgenerator-word-node">this​</span><span class="kix-wordhtmlgenerator-word-node">.​</span><span class="kix-wordhtmlgenerator-word-node">designation​ ​​</span><span class="kix-wordhtmlgenerator-word-node">=​</span><span class="kix-wordhtmlgenerator-word-node">​ ​designation​</span><span class="kix-wordhtmlgenerator-word-node">;</span><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;
</span></span><span class="kix-wordhtmlgenerator-word-node">​</span><span class="kix-wordhtmlgenerator-word-node">}</span><span class="goog-inline-block kix-lineview-text-block"><span class="kix-wordhtmlgenerator-word-node"><span class="goog-inline-block">&nbsp;</span></span></span>&nbsp;
}

</pre>
<h3><span style="color: #000000;"><strong>How do we achieve encapsulation in Java?</strong></span></h3>
We can achieve complete encapsulation in java by making members of a class private and access them outside the class only through getters and setters. Although a lesser degree of encapsulation can be achieved<span style="font-weight: 400;"> by making the members public or protected.</span>
<h3><span style="color: #000000;"><strong>What is encapsulation in object oriented programming?</strong></span></h3>
Encapsulation<span style="font-weight: 400;"> is an </span>Object Oriented Programming<span style="font-weight: 400;"> concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. ... C++ supports the properties of </span>encapsulation <span style="font-weight: 400;">and data hiding through the creation of user-defined types, called classes.</span>
<h3><span style="color: #000000;"><strong>Why Encapsulation use in Java Code?</strong></span></h3>
<span style="font-weight: 400;">Here are some advantages to use encapsulation in Java Code.</span>
<ul>
<li><span style="font-weight: 400;">Encapsulated Code is more flexible and easy to change with new requirements.</span></li>
<li><span style="font-weight: 400;">By providing only getter and setter method access, you can make the class read only.</span></li>
<li><span style="font-weight: 400;">Encapsulation in Java makes unit testing easy.</span></li>
<li><span style="font-weight: 400;">A class can have total control over what is stored in its fields. Suppose you want to set the value of marks field i.e. marks should be positive value, than you can write the logic of positive value in setter method.</span></li>
<li><span style="font-weight: 400;">Encapsulation also helps to write immutable class in Java which are a good choice in multi-threading environments.</span></li>
<li><span style="font-weight: 400;">Encapsulation allows you to change one part of code without affecting other par</span></li>
</ul>
<h3><span style="color: #000000;"><strong>Benefits of encapsulation</strong></span></h3>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Provides abstraction between an object and its clients.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Protects an object from unwanted access by clients.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Example: A bank application forbids (restrict) a client to change an Account's balance.</span></li>
</ul>
<h3><span style="color: #000000;"><strong>Advantage of Encapsulation in java</strong></span></h3>
<ul>
<li><span style="font-weight: 400;">Objects encapsulate data and implementation details. To the outside world, an object is a black box that exhibits a certain behavior.</span></li>
<li><span style="font-weight: 400;">The behavior of this object is what which is useful for the external world or other objects.</span></li>
<li><span style="font-weight: 400;">An object exposes its behavior by means of public methods or functions.</span></li>
<li><span style="font-weight: 400;">The set of functions an object exposes to other objects or external world acts as the interface of the object.</span></li>
</ul>
<span style="color: #000000;"><strong>For indepth understanding of java click on</strong></span></div>
<div class="kix-lineview"><a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java Tutorials</a></div>
<div class="kix-lineview"><a href="https://tekslate.com/java-interface-in-java/" target="_blank" rel="noopener">Interface in Java</a></div>
<div class="kix-lineview"><a href="https://tekslate.com/java-multithreading-in-java/" target="_blank" rel="noopener">Multithreading in java</a></div>
<div class="kix-lineview"><a href="https://tekslate.com/polymorphism-in-java/" target="_blank" rel="noopener">Polymorphism in Java</a></div>
<div class="kix-lineview"><a href="https://tekslate.com/java-annotations-in-java" target="_blank" rel="noopener">Java Annotations</a></div>
</div>
</div>
</div>
</div>
</div>37:T346d,<h2><span style="color: #000000;">Packages in java</span></h2>
<p><span style="font-weight: 400;">A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer. You might keep HTML pages in one folder, images in another, and scripts or applications in yet another. Because software written in the Java programming language can be composed of hundreds or </span><em><span style="font-weight: 400;">thousands</span></em><span style="font-weight: 400;"> of individual classes, it makes sense to keep things organized by placing related classes and interfaces into packages.</span> <span style="font-weight: 400;">The Java platform provides an enormous class library (a set of packages) suitable for use in your own applications. This library is known as the "<a href="https://en.wikipedia.org/wiki/Application_programming_interface" target="_blank" rel="noopener">Application Programming Interface</a>", or "API" for short. Its packages represent the tasks most commonly associated with general-purpose programming. For example, a String object contains state and behavior for character strings; a File object allows a programmer to easily create, delete, inspect, compare, or modify a file on the filesystem; a Socket object allows for the creation and use of network sockets; various GUI objects control buttons and checkboxes and anything else related to graphical user interfaces. There are literally thousands of classes to choose from. This allows you, the programmer, to focus on the design of your particular application, rather than the infrastructure required to make it work.</span> <strong>Syntax of the Package in Java:</strong></p>
<pre style="padding-left: 30px;"><span style="font-weight: 400;">package &lt;Package Name&gt;;</span></pre>
<h3><strong><span style="color: #000000;">Types of package:</span></strong></h3>
<ul>
<li><span style="font-weight: 400;">User defined package: The package we create is called user-defined package.</span></li>
<li><span style="font-weight: 400;">Built-in package: The already defined package like java.io.*, java.lang.* etc are known as built-in packages.</span></li>
</ul>
<h3><span style="color: #000000;"><strong>How to use package</strong></span></h3>
<p>There are 2 ways in order to use the public classes stored in package.</p>
<ul>
<li><span style="font-weight: 400;"> Declare the fully-qualified class name. For example,</span></li>
</ul>
<pre style="padding-left: 30px;"><span style="font-weight: 400;">...</span>
<span style="font-weight: 400;">world.HelloWorld helloWorld = new world.HelloWorld();</span>
<span style="font-weight: 400;">world.moon.HelloMoon helloMoon = new world.moon.HelloMoon();</span>
<span style="font-weight: 400;">String holeName = helloMoon.getHoleName();</span>
<span style="font-weight: 400;">...</span>

</pre>
<ul>
<li><span style="font-weight: 400;">Use an "import" keyword:</span></li>
</ul>
<pre style="padding-left: 30px;"><span style="font-weight: 400;">import world.*; &nbsp;</span><em><span style="font-weight: 400;">// we can call any public classes inside the </span></em><strong><em>world</em></strong><em><span style="font-weight: 400;"> package</span></em> 
<span style="font-weight: 400;">import world.moon.*; &nbsp;</span><em><span style="font-weight: 400;">// we can call any public classes inside the </span></em><strong><em>world.moon</em></strong><em><span style="font-weight: 400;"> package</span></em>
<span style="font-weight: 400;">import java.util.*; &nbsp;</span><em><span style="font-weight: 400;">// import all public classes from </span></em><strong><em>java.util</em></strong><em><span style="font-weight: 400;"> package</span></em>
<span style="font-weight: 400;">import java.util.Hashtable; &nbsp;</span><em><span style="font-weight: 400;">// import only </span></em><strong><em>Hashtable</em></strong><em><span style="font-weight: 400;"> class (not all classes in java.util package)</span></em>

</pre>
<p><span style="font-weight: 400;">Thus, the code that we use to call the HelloWorld and HelloMoon class should be</span></p>
<pre style="padding-left: 30px;"><span style="font-weight: 400;">...</span>
<span style="font-weight: 400;"> &nbsp;HelloWorld helloWorld = new HelloWorld(); </span><em><span style="font-weight: 400;">// don't have to explicitly specify world.HelloWorld anymore</span></em>
<span style="font-weight: 400;"> &nbsp;HelloMoon helloMoon = new HelloMoon(); </span><em><span style="font-weight: 400;">// don't have to explicitly specify world.moon.HelloMoon anymore</span></em>
<span style="font-weight: 400;">... &nbsp;</span></pre>
<p><span style="font-weight: 400;">Note that we can call public classes stored in the package level we do the import only. We can't use any classes that belong to the subpackage of the package we import. For example, if we import package world, we can use only the HelloWorld class, but not the HelloMoon class.</span></p>
<h2><span style="color: #000000;"><strong>How to create a package</strong></span></h2>
<p>At first create a folder like a name &lt;cei&gt; and store a program. <strong>Listing 1</strong>: Sample showing Example using package. This is the package program</p>
<div class="div_listagem">
<pre class="pre_listagem" style="padding-left: 30px;">armstrong.java
public class armstrong
{
	int x=407;
	int r,temp,a=0;
	public void test()
	{
	temp=x;
	while(x&gt;0)
	{
		r=x%10;
		a=a+(r*r*r);
		x=x/10;
	}
	if(temp==a)
	{
		System.out.println("This is Armstrong no..");
	}
else
{
		System.out.println("This is not Armstrong no..");
}	
}	
}</pre>
</div>
<p>After the creation of the program then compile this program with following syntax:</p>
<div class="div_listagem">
<pre class="pre_listagem" style="padding-left: 30px;">javac  armstrong.java</pre>
</div>
<p>If compile this part with successfully then write down this program. <strong>Listing 2</strong>: Sample showing Example calling package</p>
<div class="div_listagem">
<pre class="pre_listagem" style="padding-left: 30px;">cal.java
import cei.*;
public class cal{
    public static void main(String args[]){
	   armstrong ob=new armstrong();
	   ob.test(); //this part is calling package method
    }
}
</pre>
</div>
<p>Then compile the code cal.java</p>
<div class="div_listagem">
<pre class="pre_listagem" style="padding-left: 30px;">javac  cal.java</pre>
</div>
<p>After that we interpreting this program cal.java</p>
<div class="div_listagem">
<pre class="pre_listagem" style="padding-left: 30px;">java  cal</pre>
</div>
<p>Then this call.java will be interpreted and run this program and show the output <strong>Output:</strong> This is Armstrong no. <img class="aligncenter" title="Packages in java-Process to Compile package program and run." src="http://file.mrbool.com/mrbool/articles/Kaushik/PackageJava/PackageJava04.jpg" alt="Packages in java" width="732" height="384" /> Process to Compile package program and run.</p>
<h3><span style="color: #000000;">Classpath Packages in Java</span></h3>
<p><code>CLASSPATH</code> is an environment variable (i.e., global variables of the operating system available to all the processes) needed for the Java compiler and runtime to locate the Java packages used in a Java program. (Why not call <code>PACKAGEPATH</code>?) This is similar to another environment variable <code>PATH</code>, which is used by the CMD shell to find the executable programs. <code>CLASSPATH</code> can be set in one of the following ways:</p>
<ul>
<li><code>CLASSPATH</code> can be set permanently in the environment: In Windows, choose control panel &rArr; System &rArr; Advanced &rArr; Environment Variables &rArr; choose "System Variables" (for all the users) or "User Variables" (only the currently login user) &rArr; choose "Edit" (if <code>CLASSPATH</code> already exists) or "New" &rArr; Enter "<code>CLASSPATH</code>" as the variable name &rArr; Enter the required directories and JAR files (separated by semicolons) as the value (e.g., "<code>.;c:\javaproject\classes;d:\tomcat\lib\servlet-api.jar</code>"). Take note that you need to include the current working directory (denoted by <code>'.'</code>) in the <code>CLASSPATH</code>.</li>
</ul>
<p>To check the current setting of the <code>CLASSPATH</code>, issue the following command:</p>
<pre class="code-command">SET CLASSPATH
</pre>
<ul>
<li><code>CLASSPATH</code> can be set temporarily for that particular CMD shell session by issuing the following command:</li>
</ul>
<pre class="code-command">SET CLASSPATH=.;c:\javaproject\classes;d:\tomcat\lib\servlet-api.jar
</pre>
<ul>
<li>Instead of using the <code>CLASSPATH</code> environment variable, you can also use the command-line option <code>-classpath</code> or <code>-cp</code> of the <code>javac</code> and <code>java</code> commands, for example,</li>
</ul>
<pre class="code-command">java &ndash;classpath c:\javaproject\classes com.abc.project1.subproject2.MyClass3</pre>
<p>&nbsp;</p>
<h3><span style="color: #000000;"><strong>How to put two public classes in a package?</strong></span></h3>
<p><span style="font-weight: 400;">Two public classes in a package, have two source files containing one public class, but keep the package name same . For example.</span></p>
<pre style="padding-left: 30px;"><span style="font-weight: 400;">//save as A.java</span><span style="font-weight: 400;"> &nbsp;
</span><span style="font-weight: 400;">package</span><span style="font-weight: 400;"> javatpoint; &nbsp;
</span><span style="font-weight: 400;">public</span> <span style="font-weight: 400;">class</span><span style="font-weight: 400;"> A{} &nbsp;
</span><span style="font-weight: 400;">//save as B.java</span><span style="font-weight: 400;"> &nbsp;</span><span style="font-weight: 400;">&nbsp;
</span><span style="font-weight: 400;">package</span><span style="font-weight: 400;"> javatpoint; &nbsp;
</span><span style="font-weight: 400;">public</span> <span style="font-weight: 400;">class</span><span style="font-weight: 400;"> B{} &nbsp;

</span></pre>
<h2 class="h2"><span style="color: #000000;">Subpackage in java</span></h2>
<p>Package inside the package is called the subpackage. It should be created to categorize the package further. Let's take an example, Sun Microsystem has definded a package named java that contains many classes like System, String, Reader, Writer, Socket etc. These classes represent a particular group e.g. Reader and Writer classes are for Input/Output operation, Socket and ServerSocket classes are for networking etc and so on. So, Sun has subcategorized the java package into subpackages such as lang, net, io etc. and put the Input/Output related classes in io package, Server and ServerSocket classes in net packages and so on.</p>
<pre><span class="keyword" style="font-family: Consolas, Monaco, monospace;">package</span><span style="font-family: Consolas, Monaco, monospace;">&nbsp;com.javatpoint.core; &nbsp;
</span><span class="keyword">class</span>&nbsp;Simple{ &nbsp;
&nbsp;&nbsp;<span class="keyword">public</span>&nbsp;<span class="keyword">static</span>&nbsp;<span class="keyword">void</span>&nbsp;main(String&nbsp;args[]){&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;System.out.println(<span class="string">"Hello&nbsp;subpackage"</span>);&nbsp;&nbsp;
&nbsp;&nbsp;}&nbsp;&nbsp;
}</pre>
<p><strong>To Compile:</strong> javac -d . Simple.java <strong>To Run:</strong> java com.javatpoint.core.Simple</p>
<pre style="padding-left: 30px;">Output:Hello subpackage</pre>
<h3><span style="font-weight: 400;"> <strong><span style="color: #000000;">Advantages of&nbsp;Packages in java</span></strong></span></h3>
<ul>
<li style="font-weight: 400;"><span style="font-weight: 400;">Package are generally used to organize the classes fitting to same category or given that similar functionality.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">A package provides a primary namespace [Namespace is collection for set of identifier].</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">The class which is belonging in same package can access each other package-access member.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">Classes are sharing the same name only if they are present in other package.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">A package provides a means to group related classes.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">To create a package we need two level each file in which the classes are defined with the name of the package.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">We can easily decide that the classes and interfaces in a single package are related.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">In generally, the names of our classes and interfaces should not conflict with the names in other packages because the package creates a new namespace.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">You can permit the classes within the package to have unrestricted access to one another yet still restrict access for types outside the package.</span></li>
<li style="font-weight: 400;"><span style="font-weight: 400;">In general, we can also declare the package name with our common name for easily remembers.</span></li>
</ul>
<p>&nbsp;</p>38:T64a1,<h2><span style="color: #000000;">Java Regular Expressions in Java</span></h2>
<p class="Bodytext20" style="background: transparent;">A <span class="Bodytext2Italic">regular expression or REGEX</span> is explained as a specific kind of text pattern that can be used in many advanced applications and with any programming language. They are used for searching, editing and manipulating data.</p>
<p class="Bodytext20" style="background: transparent;">For example, using regular expressions we can verify if a particular input string matches a given text pattern or to find out a set of characters from a large batch of characters. They are also used in replacing and re-arranging a block of text or splitting a big chunk of data into smaller subsets. Regular expressions are generally not language specific and follow a similar pattern in most of the programming languages, but with slight variation.</p>
<p class="Bodytext20" style="background: transparent;">Regular expressions are powerful tools and would reduce the time taken for processing a job, when your program needs to manipulate or extract text on computer. By using them skillfully, regular expressions help us to perform many tasks that wouldn't be feasible at all.</p>
<p class="Bodytext20" style="margin-bottom: .0001pt; background: transparent;">Regular expressions are so useful in real life computing that, the various systems and languages have evolved to provide both a fundamental and protracted standard for the grammar and syntax for usage of modern regular expressions. Also Regular expression processors are found in major of the search engines, search and replace place-holders of various word processors and text editors, and in the command lines of utilities that are used in processing text inputs.</p>
<p>Here's a set of strings that have a few things in common:</p>
<ul>
<li>A string</li>
<li>A longer string</li>
<li>A much longer string</li>
</ul>
<p>Note that each of these strings begins with <em>A</em> and ends with <em>string</em>. The <a href="http://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html">Java Regular Expressions API</a> helps you pull out these elements, see the pattern among them, and do interesting things with the information you've gleaned. The Regular Expressions API has three core classes that you use almost all the time:</p>
<ul>
<li>Pattern describes a string pattern.</li>
<li>Matcher tests a string to see if it matches the pattern.</li>
<li>PatternSyntaxException tells you that something wasn't acceptable about the pattern that you tried to define.</li>
</ul>
<p>You'll begin working on a simple regular-expressions pattern that uses these classes shortly. But first, take a look at the regex pattern syntax. <strong>Regex pattern syntax</strong> A <em>regex pattern</em> describes the structure of the string that the expression tries to find in an input string. The pattern syntax can look strange to the uninitiated, but once you understand it, you'll find it easier to decipher. Table 1 lists some of the most common regex constructs that you use in pattern strings.</p>
<table style="height: 458px;" width="684">
<thead>
<tr>
<td><strong>Regex construct</strong></td>
<td><strong>What qualifies as a match</strong></td>
</tr>
</thead>
<tbody>
<tr>
<td>.</td>
<td>Any character</td>
</tr>
<tr>
<td>?</td>
<td>Zero (0) or one (1) of what came before</td>
</tr>
<tr>
<td>*</td>
<td>Zero (0) or more of what came before</td>
</tr>
<tr>
<td>+</td>
<td>One (1) or more of what came before</td>
</tr>
<tr>
<td>[]</td>
<td>A range of characters or digits</td>
</tr>
<tr>
<td>^</td>
<td>Negation of whatever follows (that is, "not <em>whatever</em>")</td>
</tr>
<tr>
<td>\d</td>
<td>Any digit (alternatively, [0-9])</td>
</tr>
<tr>
<td>\D</td>
<td>Any nondigit (alternatively, [^0-9])</td>
</tr>
<tr>
<td>\s</td>
<td>Any whitespace character (alternatively, [\n\t\f\r])</td>
</tr>
<tr>
<td>\S</td>
<td>Any nonwhitespace character (alternatively, [^\n\t\f\r])</td>
</tr>
<tr>
<td>\w</td>
<td>Any word character (alternatively, [a-zA-Z_0-9])</td>
</tr>
<tr>
<td>\W</td>
<td>Any nonword character (alternatively, [^\w])</td>
</tr>
</tbody>
</table>
<p>The first few constructs are called <em>quantifiers</em>, because they quantify what comes before them. Constructs like \d are predefined character classes. Any character that doesn't have special meaning in a pattern is a literal and matches itself. The first few constructs are called <em>quantifiers</em>, because they quantify what comes before them. Constructs like \d are predefined character classes. Any character that doesn't have special meaning in a pattern is a literal and matches itself.</p>
<h3><span style="color: #000000;">Pattern matching</span></h3>
<p>Armed with the pattern syntax in <a href="http://www.ibm.com/developerworks/java/library/j-perry-regular-expressions/index.html#table2">Table 1</a>, you can work through the simple example in Listing 1, using the classes in the Java Regular Expressions API.</p>
<h5>Listing 1. Pattern matching with regex</h5>
<table>
<tbody>
<tr>
<td>
<pre>Pattern pattern = Pattern.compile("[Aa].*string");
Matcher matcher = pattern.matcher("A string");
boolean didMatch = matcher.matches();
Logger.getAnonymousLogger().info (didMatch);
int patternStartIndex = matcher.start();
Logger.getAnonymousLogger().info (patternStartIndex);
int patternEndIndex = matcher.end();
Logger.getAnonymousLogger().info (patternEndIndex);</pre>
</td>
</tr>
</tbody>
</table>
<p>First, Listing 1 creates a Pattern class by calling compile()&mdash; a static method on Pattern&mdash; with a string literal representing the pattern you want to match. That literal uses the regex pattern syntax. In this example, the English translation of the pattern is: <em>Find a string of the form </em><em>A</em><em> or </em><em>a</em><em> followed by zero or more characters, followed by </em><em>string</em>.</p>
<h3><span style="color: #000000;">Methods for matching</span></h3>
<p>Next, Listing 1 calls matcher() on Pattern. That call creates a Matcher instance. The Matcher then searches the string you passed in for matches against the pattern string you used when you created the Pattern. Every Java language string is an indexed collection of characters, starting with 0 and ending with the string length minus one. The Matcher parses the string, starting at 0, and looks for matches against it. After that process is complete, the Matcher contains information about matches found (or not found) in the input string. You can access that information by calling various methods on Matcher:</p>
<ul>
<li>matches() tells you if the entire input sequence was an exact match for the pattern.</li>
<li>start() tells you the index value in the string where the matched string starts.</li>
<li>end() tells you the index value in the string where the matched string ends, plus one.</li>
</ul>
<p>Listing 1 finds a single match starting at 0 and ending at 7. Thus, the call to matches() returns true, the call to start() returns 0, and the call to end() returns 8.</p>
<h3><span style="color: #000000;">lookingAt() versus matches()</span></h3>
<p>If your string had more elements than the number of characters in the pattern you searched for, you could use lookingAt() instead of matches(). The lookingAt() method searches for substring matches for a specified pattern. For example, consider the following string:</p>
<table>
<tbody>
<tr>
<td>
<pre>a string with more than just the pattern.</pre>
</td>
</tr>
</tbody>
</table>
<p>If you search this string for a.*string, you get a match if you use lookingAt(). But if you use matches(), it returns false, because there's more to the string than what's in the pattern.</p>
<h2><span style="color: #000000;">Complex patterns in regex</span></h2>
<p>Simple searches are easy with the regex classes, but you can also do highly sophisticated things with the Regular Expressions API. Wikis are based almost entirely on regular expressions. Wiki content is based on string input from users, which is parsed and formatted using regular expressions. Any user can create a link to another topic in a wiki by entering a wiki word, which is typically a series of concatenated words, each of which begins with an uppercase letter, like this:</p>
<table>
<tbody>
<tr>
<td>
<pre>MyWikiWord</pre>
</td>
</tr>
</tbody>
</table>
<p>Suppose a user inputs the following string:</p>
<table>
<tbody>
<tr>
<td>
<pre>Here is a WikiWord followed by AnotherWikiWord, then YetAnotherWikiWord.</pre>
</td>
</tr>
</tbody>
</table>
<p>You could search for wiki words in this string with a regex pattern like this:</p>
<table>
<tbody>
<tr>
<td>
<pre>[A-Z][a-z]*([A-Z][a-z]*)+</pre>
</td>
</tr>
</tbody>
</table>
<p>And here's code to search for wiki words:</p>
<table>
<tbody>
<tr>
<td>
<pre>String input = "Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.";
Pattern pattern = Pattern.compile("[A-Z][a-z]*([A-Z][a-z]*)+");
Matcher matcher = pattern.matcher(input);
while (matcher.find()) {
&nbsp;&nbsp;Logger.getAnonymousLogger().info("Found this wiki word: " + matcher.group());
}</pre>
</td>
</tr>
</tbody>
</table>
<p>Run this code, and you can see the three wiki words in your console.</p>
<h2><span style="color: #000000;">Replacing strings</span></h2>
<p>Searching for matches is useful, but you also can manipulate strings after you find a match for them. You can do that by replacing matched strings with something else, just as you might search for text in a word-processing program and replace it with other text. Matcher has a couple of methods for replacing string elements:</p>
<ul>
<li>replaceAll() replaces all matches with a specified string.</li>
<li>replaceFirst() replaces only the first match with a specified string.</li>
</ul>
<p>Using Matcher's replace methods is straightforward:</p>
<table>
<tbody>
<tr>
<td>
<pre>String input = "Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.";
Pattern pattern = Pattern.compile("[A-Z][a-z]*([A-Z][a-z]*)+");
Matcher matcher = pattern.matcher(input);
Logger.getAnonymousLogger().info("Before: " + input);
String result = matcher.replaceAll("replacement");
Logger.getAnonymousLogger().info("After: " + result);</pre>
</td>
</tr>
</tbody>
</table>
<p>This code finds wiki words, as before. When the Matcher finds a match, it replaces the wiki word text with its replacement. When you run the code, you can see the following on your console:</p>
<table>
<tbody>
<tr>
<td>
<pre>Before: Here is WikiWord followed by AnotherWikiWord, then SomeWikiWord.
After: Here is replacement followed by replacement, then replacement.</pre>
</td>
</tr>
</tbody>
</table>
<p>If you had used replaceFirst(), you would have seen this:</p>
<table>
<tbody>
<tr>
<td>
<pre>Before: Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.
After: Here is a replacement followed by AnotherWikiWord, then SomeWikiWord.</pre>
</td>
</tr>
</tbody>
</table>
<h2><span style="color: #000000;">Matching and manipulating groups</span></h2>
<p>When you search for matches against a regex pattern, you can get information about what you found. You've seen some of that capability with the start() and end() methods on Matcher. But it's also possible to reference matches by capturing <em>groups</em>. In each pattern, you typically create groups by enclosing parts of the pattern in parentheses. Groups are numbered from left to right, starting with 1 (group 0 represents the entire match). The code in Listing 2 replaces each wiki word with a string that "wraps" the word:</p>
<h5><span style="color: #000000;">Listing 2. Matching groups</span></h5>
<table>
<tbody>
<tr>
<td>
<pre>String input = "Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.";
Pattern pattern = Pattern.compile("[A-Z][a-z]*([A-Z][a-z]*)+");
Matcher matcher = pattern.matcher(input);
Logger.getAnonymousLogger().info("Before: " + input);
String result = matcher.replaceAll("blah$0blah");
Logger.getAnonymousLogger().info("After: " + result);</pre>
</td>
</tr>
</tbody>
</table>
<p>Run the <a href="http://www.ibm.com/developerworks/java/library/j-perry-regular-expressions/index.html#listing2">Listing 2</a> code, and you get the following console output:</p>
<table>
<tbody>
<tr>
<td>
<pre>Before: Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.
After: Here is a blahWikiWordblah followed by blahAnotherWikiWordblah,then blahSomeWikiWordblah.</pre>
</td>
</tr>
</tbody>
</table>
<p>Listing 2 references the entire match by including $0 in the replacement string. Any portion of a replacement string of the form $<em>int</em> refers to the group identified by the integer (so $1 refers to group 1, and so on). In other words, $0 is equivalent to matcher.group(0);. You could accomplish the same replacement goal by using other methods. Rather than calling replaceAll(), you could do this:</p>
<table>
<tbody>
<tr>
<td>
<pre>StringBuffer buffer = new StringBuffer();
while (matcher.find()) {
&nbsp;matcher.appendReplacement(buffer, "blah$0blah");
}
matcher.appendTail(buffer);
Logger.getAnonymousLogger().info("After: " + buffer.toString());</pre>
</td>
</tr>
</tbody>
</table>
<p>And you'd get the same result:</p>
<table>
<tbody>
<tr>
<td>
<pre>Before: Here is a WikiWord followed by AnotherWikiWord, then SomeWikiWord.
After: Here is a blahWikiWordblah followed by blahAnotherWikiWordblah,then blahSomeWikiWordblah.</pre>
</td>
</tr>
</tbody>
</table>
<h3><span style="color: #000000;"><strong>Common Uses</strong></span></h3>
<p>Regular expressions are majorly used in a wide variety of text processing tasks, and more generally string processing, where the data need not be textual. Common applications include data validation, data scraping, data wrangling, simple parsing, the production of syntax highlighting systems, and many other tasks. While regular expressions would be useful on Internet search engines, processing them across the entire database could consume excessive computer resources depending on the complexity and design of the regex. Some important uses of regular expressions are:</p>
<ul>
<li>URL validation</li>
<li>Email Validation</li>
<li>Validation of numbers, characters and special characters</li>
<li>Internet address</li>
<li>Extracting information from text such as code, log files, spreadsheets, or documents.</li>
<li>Search and replace Strings</li>
</ul>
<p><strong>Note:</strong></p>
<ul>
<li>Keep in mind, when using regular expression everything is essentially a character, and we are writing patterns to match a specific sequence of characters (also known as a string).</li>
<li>Generally patterns are provided in ASCII, which includes letters, digits, punctuation and other symbols on your keyboard like %#$@!</li>
<li>Unicode characters are used to match any type of international text Understanding the Regex Engine</li>
</ul>
<p>One of the most important things to do is to take a look at How a Regex Engine Works Internally because knowing how the regex engine works will help us to craft better regexes more easily. It will also help in understanding quickly why a particular regex does work in the way it was initially expected to do so. This will also save lots of guesswork and head scratching when w<sup>T</sup>e need to wuite more complex regexes. There are two kinds of regular expression engines:</p>
<ul>
<li>text-directed engines</li>
<li>Regex-directed engines.</li>
</ul>
<ol>
<li>Mostly all the regex flavors available are based on regex-directed engines. This is because certain very<sup>7</sup> useful features, such as lazy quantifiers and back references, can only be implemented in regex-directed engines.</li>
<li>You can easily find out whether the regex flavor you intend to use has a text- directed or regex-directed engine. If back references and/or lazy quantifiers are available, you can be certain the engine is regex-directed.</li>
<li>You can do the test by applying the regex &laquo;text|text not&raquo; to the string '&lsquo;text not&rdquo;. If the resulting match is only &ldquo;text&rdquo;, the engine is regex-directed. If the result is &ldquo;text not&rdquo;, then it is text-directed. The reason behind this is that the regex-directed engine is an early starter.</li>
<li>Before looking into the examples provided, understanding how the regex engine works will enable you to use its full power and help you avoid common mistakes.</li>
</ol>
<p>The Regex-Directed Engine Always Returns the Leftmost Match. There are some important points to be noted when working with engines:</p>
<ul>
<li>A regex-directed engine wall always return the leftmost match, even if a more suitable match could be found later.</li>
<li>When applying a regex to a string, the engine will start at the first character of the string. It wall try all possible variations of the regular expression at the first character. Only if all possibilities have been tried and found to fail, will the engine continue with the second character in the text. Otherwise it will stop there</li>
<li>Again, it wall try all possible variations of the regex, in exactly the same order till it finds a match.</li>
<li>The result is that the regex-directed engine wall return the leftmost match.</li>
</ul>
<p>Let us consider the example, searching &laquo;book&raquo; to &ldquo;He bought a bookshelf for his book." The engine will try to match the first token in the regex &laquo;b&raquo; to the first character in the match &ldquo;H&ldquo;. This fails. There are no other possible permutations of this regex, because it merely consists of a sequence of literal characters. So the regex engine tries to match the &laquo;b&raquo; with the &ldquo;e". This fails too, as does matching the &laquo;b&raquo; with the space. Arriving at the 4th character in the match, &laquo;b&raquo; matches &ldquo;b&rdquo;. The engine will then try to match the second token &laquo;o&raquo; to the 5th character, &ldquo;o&rsquo;&rsquo;. This succeeds too. But then, &laquo;o&raquo; fails to match &ldquo;u&rdquo;. At that point, the engine knows the regex cannot be matched starting at the 4th character in the match. So it will continue with the 5th: &ldquo;a&rdquo;. Again, &laquo;b&raquo;fails to match here and the engine carries on. At the 30th character in the match, &laquo;b&raquo; again matches &ldquo;b&rdquo;.</p>
<ul>
<li>The engine then proceeds to attempt to match the remainder of the regex at character 30th and finds that &laquo;o&raquo; matches &ldquo;o&rdquo;, again &lt;&lt;o&gt;&gt; matches &ldquo;o&rdquo; and &laquo;k&raquo; matches &ldquo;k&rdquo;. The complete regex could be matched starting at character 30. The engine is an early starter to report a match. It will therefore report the first three letters of catfish as a valid match. The engine never proceeds beyond this point to see if there are any &ldquo;better&rdquo; matches. In this first example of the engine&rsquo;s internals, our regex engine simply appears to work like a regular text search routine.</li>
</ul>
<p>A text-directed engine would have returned the same result too. However, it is important that you can follow the steps the engine takes in your mind. In following examples, the way the engine works will have a profound impact on the matches it will find. Some of the results may be surprising. But they are always logical and predetermined, once you know how the engine works.</p>
<h3><span style="color: #000000;"><strong>Algorithms Used in Regex</strong></span></h3>
<p>When using regex, there are at least three different algorithms that decide whether and how<sup>7</sup> a given regular expression matches a string.</p>
<h3><span style="color: #000000;"><strong>Converting NFA to DFA</strong></span></h3>
<p class="Bodytext20" style="margin-bottom: 15.6pt; background: transparent;">This is the first and quickest method. It is based on a result in formal language theory that permits every non-deterministic finite automaton (NFA) to become into a deterministic finite automaton (DFA). The DFA can be explicitly constructed then run on the resulting input string one by one symbol at a time.</p>
<h3><span style="color: #000000;"><strong>Simulating NFA Directly (DFA/NFA Algorithm)</strong></span></h3>
<p>The next method is to simulate the NFA directly, constructing each DFA state on demand and then discarding it at the next execution step. This method keeps the DFA implicit and avoids increase of the construction cost exponentially, but has an overhead of rising the running cost to 0(m n). The explicit an implicit approaches are called the DFA algorithm and the NFA algorithm respectively Adding caching to the NFA algorithm is often called the "lazy DFA" algorithm or just the DFA algorithm without making a distinction.</p>
<h3><span style="color: #000000;"><strong>Backtracking</strong></span></h3>
<p>The third and final algorithm is to match the pattern against the input string by backtracking. This algorithm is usually called as NFA, but this terminology can be confusing a times. This is used simple implementations which exhibit when matching against expressions like (a|aa)*b that contain both alternation and unbounded quantification. This kind of processing can force the algorithm to consider an exponentially increasing number of sub-cases. This might also lead to security problems called Regular expression Denial of Service.</p>
<h3><span style="color: #000000;"><strong>Common Regex Syntaxes</strong></span></h3>
<p>A regular expression is in the bottom a string patterns that represents text. These descriptions can be applied in several ways. The basic language constructs embrace character classes, quantifiers, and meta-characters. The below section explains the various options we can use to define regular expression.</p>
<ul>
<li>String Literals</li>
</ul>
<p>String literals are used to search a particular match in the text. For example, if we are going to search for a text &ldquo;test'&rsquo; then we can simply write the code like this: Here text and regex both are same. Pattern.matches("test", "test")</p>
<ul>
<li>Character Classes</li>
</ul>
<p>A character class is used to match a single character in the input text against multiple allowed characters in the character class, a character class has no relation with a class construct or class files in Java. Examples:</p>
<ol>
<li>[Tt]est would match all the occurrences of String &ldquo;test&rdquo; with either lower case or upper case &ldquo;T&rdquo;.</li>
<li>The string "A@BAND@YEA@U" matches the pattern &rdquo;[ABC]@." twice even though the string contains three @ signs.</li>
<li>The second @ is not a part of any match, because it is preceded by D and not A, B. or C.</li>
</ol>
<p>Few more samples: Pattem.matches("[pqr]<sup>M</sup>, "abed"); It would give false as no p,q or r in the text Pattem.matches("[pqr]<sup>M</sup>, "r"); Return true as r is found Pattem.matches("[pqr]<sup>M</sup>, "pq"); Return false as any one of them can be in text not both. The meta characters [ and ] (left and right brackets) are used to specify a character class inside a regular expression. Sometimes we limit the characters that produce matches to a special set of characters. Here is the sample list of various character classes constructs:</p>
<ol>
<li><strong>Simple:</strong> consists in a group of characters set up side by side and matches only those characters. Example: [abc] matches characters a, b, and c.</li>
</ol>
<p>Let's take a look at the following example:</p>
<p style="padding-left: 30px;">[csw] cave matches c in [csw] with c in cave.</p>
<ol start="2">
<li><strong>Negation:</strong> starts with the <sup>A</sup> meta-character and matches only those characters not in that class.</li>
</ol>
<p>Example: [<sup>A</sup>abc] matches all characters except a, b, and c.</p>
<p style="padding-left: 30px;">Let's see a second example:</p>
<p style="padding-left: 30px;">[<sup>A</sup>csw] cave matches a, v, and e with their counterparts in cave.</p>
<ol start="3">
<li><strong>Range:</strong> involves all characters starting with the character on the left of a hyphen meta character (-) and finishing with the character on the right of the hyphen meta character, matching only those characters in that range.</li>
</ol>
<p>Example: [a-z] matches all lowercase alphabetic characters.</p>
<p style="padding-left: 30px;">Let's see another example:</p>
<p style="padding-left: 30px;">[a-c] clown matches c in [a-c] with c in clown.</p>
<ol start="4">
<li><strong>Union</strong>: involves multiple nested character classes and matches all characters that fit to the resulting union.</li>
</ol>
<p>Example: [a-d[m-p]] matches characters a through d and m through p.</p>
<p style="padding-left: 30px;">Let's see a second example:</p>
<p style="padding-left: 30px;">[ab[c-e]] abcdef matches a, b, c, d, and e with their counterparts in abcdef.</p>
<ol start="5">
<li><strong>Intersection:</strong> involves characters usual to all nested classes and matches only common characters.</li>
</ol>
<p>Example: [a-z&amp;&amp;[d-f]] matches characters d, e, and f. Other example:</p>
<p style="padding-left: 30px;">[aeiouv&amp;&amp;[y]] party matches v in [aeiou&amp;&amp;[y]] with v in party..</p>
<ol start="6">
<li><strong>Subtraction</strong>: involve all characters less those indicated in nested negation character classes and matches the remaining characters.</li>
</ol>
<p style="padding-left: 30px;">Example: [a-z&amp;&amp;[<sup>A</sup>m-p]] matches characters a through 1 and q through z.</p>
<p style="padding-left: 30px;">The following command line offers a second example:</p>
<p style="padding-left: 30px;">[a-f&amp;&amp;[<sup>A</sup>a-c]&amp;&amp;[<sup>A</sup>e]] abcdefg matches d and f with their counterparts in abcdefg.</p>39:T4541,<div id="nmtbi6" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="60" data-ved="0ahUKEwj5zdrckILRAhVBHJQKHWpeCNEQuk4IPCgA">
<div class="_eHi">
<h2 class="_rhf"><span style="color: #000000;">Arraylist in java</span></h2>
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="80"><span class="_Tgc _y9e">An ArrayList is a dynamic data structure, meaning items can be added and removed from the list. A normal array in java is a static data structure, because you stuck with the initial size of your array.</span></div>
</div>
<div class="g">&nbsp;</div>
<h3 class="_rhf">&nbsp;</h3>
</div>
</div>
<div id="nmtbi6cntw" class="nmcw nmbl nmca" data-hveid="61" data-ved="0ahUKEwj5zdrckILRAhVBHJQKHWpeCNEQu04IPSgB">
<div id="nmtbi6cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="62">
<div id="nmtbi8" class="_qhf _grf nmiw nmtbi nmt nmtbia " data-hveid="68" data-ved="0ahUKEwj5zdrckILRAhVBHJQKHWpeCNEQuk4IRCgA">
<div class="_eHi">
<h3 class="_rhf"><span style="color: #000000;">What is the ArrayList in Java?</span></h3>
</div>
</div>
<div id="nmtbi8cntw" class="nmcw nmbl nmca" data-hveid="69" data-ved="0ahUKEwj5zdrckILRAhVBHJQKHWpeCNEQu04IRSgB">
<div id="nmtbi8cnt">
<div class="_Zjj">
<div class="mod" data-md="61">
<div class="_oDd" data-hveid="70"><span class="_Tgc _y9e">The ArrayList class extends AbstractList and implements the List interface. ArrayList supports <a href="https://en.wikipedia.org/wiki/Dynamic_array" target="_blank" rel="noopener">dynamic arrays</a> that can grow as needed. Standard <a href="https://tekslate.com/tutorials/java-tutorials/" target="_blank" rel="noopener">Java</a> arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means that you must know in advance how many elements an array will hold.</span></div>
</div>
<div class="_oDd" data-hveid="70">
<h4><span style="color: #000000;">Example</span></h4>
The following program illustrates several of the methods supported by ArrayList &minus;
<pre class="prettyprint notranslate tryit prettyprinted"><span class="kwd">import</span><span class="pln"> java</span><span class="pun">.</span><span class="pln">util</span><span class="pun">.*;</span>
<span class="kwd">public</span> <span class="kwd">class</span> <span class="typ">ArrayListDemo</span> <span class="pun">{</span>
   <span class="kwd">public</span> <span class="kwd">static</span> <span class="kwd">void</span><span class="pln"> main</span><span class="pun">(</span><span class="typ">String</span><span class="pln"> args</span><span class="pun">[])</span> <span class="pun">{</span>
      <span class="com">// create an array list</span>
      <span class="typ">ArrayList</span><span class="pln"> al </span><span class="pun">=</span> <span class="kwd">new</span> <span class="typ">ArrayList</span><span class="pun">();</span>
      <span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Initial size of al: "</span> <span class="pun">+</span><span class="pln"> al</span><span class="pun">.</span><span class="pln">size</span><span class="pun">());</span>
      <span class="com">// add elements to the array list</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="str">"C"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="str">"A"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="str">"E"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="str">"B"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="str">"D"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="str">"F"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">add</span><span class="pun">(</span><span class="lit">1</span><span class="pun">,</span> <span class="str">"A2"</span><span class="pun">);</span>
      <span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Size of al after additions: "</span> <span class="pun">+</span><span class="pln"> al</span><span class="pun">.</span><span class="pln">size</span><span class="pun">());</span>
      <span class="com">// display the array list</span>
      <span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Contents of al: "</span> <span class="pun">+</span><span class="pln"> al</span><span class="pun">);</span>
      <span class="com">// Remove elements from the array list</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">remove</span><span class="pun">(</span><span class="str">"F"</span><span class="pun">);</span><span class="pln">
      al</span><span class="pun">.</span><span class="pln">remove</span><span class="pun">(</span><span class="lit">2</span><span class="pun">);</span>
      <span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Size of al after deletions: "</span> <span class="pun">+</span><span class="pln"> al</span><span class="pun">.</span><span class="pln">size</span><span class="pun">());</span>
      <span class="typ">System</span><span class="pun">.</span><span class="kwd">out</span><span class="pun">.</span><span class="pln">println</span><span class="pun">(</span><span class="str">"Contents of al: "</span> <span class="pun">+</span><span class="pln"> al</span><span class="pun">);</span>
   <span class="pun">}</span>
<span class="pun">}</span></pre>
This will produce the following result &minus;
<h4><span style="color: #000000;">Output</span></h4>
<pre class="result notranslate" style="padding-left: 30px;">Initial size of al: 0
Size of al after additions: 7
Contents of al: [C, A2, A, E, B, D, F]
Size of al after deletions: 5
Contents of al: [C, A2, E, B, D]</pre>
<h3><span style="color: #000000;">Arraylist Methods</span></h3>
<ul>
<li><strong>Arraylist add</strong>: This is used to add elements to the Array List. If an ArrayList already contains elements, the new element gets added after the last element unless the index is specified.</li>
<li><strong>Arraylist remove</strong>: The specified element is removed from the list and the size is reduced accordingly. Alternately, you can also specify the index of the element to be removed.</li>
<li><strong>Java array size</strong>:&nbsp; This will give you the number of elements in the Array List. Just like arrays, here too the first element starts with index 0.</li>
<li><strong>Arraylistcontains</strong>:&nbsp; This method will return true if the list contains the specified element.</li>
</ul>
<h3 class="h3"><span style="color: #000000;">User-defined class objects in Java ArrayList</span></h3>
<div class="codeblock">
<pre><span class="keyword">class</span>&nbsp;Student{&nbsp;&nbsp;
&nbsp;<span class="keyword">int</span>&nbsp;rollno;&nbsp;&nbsp;
&nbsp;&nbsp;String&nbsp;name;&nbsp;&nbsp;
&nbsp;&nbsp;<span class="keyword">int</span>&nbsp;age;&nbsp;&nbsp;
&nbsp;&nbsp;Student(<span class="keyword">int</span>&nbsp;rollno,String&nbsp;name,<span class="keyword">int</span>&nbsp;age){&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<span class="keyword">this</span>.rollno=rollno;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<span class="keyword">this</span>.name=name;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;<span class="keyword">this</span>.age=age;&nbsp;&nbsp;
}&nbsp;&nbsp;
}<span style="color: #000000;"> &nbsp;</span></pre>
</div>
<div class="codeblock">
<pre><span class="keyword">import</span>&nbsp;java.util.*;&nbsp;&nbsp;
<span class="keyword">public</span>&nbsp;<span class="keyword">class</span>&nbsp;TestCollection3{&nbsp;&nbsp;
&nbsp;<span class="keyword">public</span>&nbsp;<span class="keyword">static</span>&nbsp;<span class="keyword">void</span>&nbsp;main(String&nbsp;args[]){&nbsp;&nbsp;
&nbsp;&nbsp;<span class="comment">//Creating&nbsp;user-defined&nbsp;class&nbsp;objects</span>&nbsp;&nbsp;
&nbsp;&nbsp;Student&nbsp;s1=<span class="keyword">new</span>&nbsp;Student(<span class="number">101</span>,<span class="string">"Sonoo"</span>,<span class="number">23</span>);&nbsp;&nbsp;
&nbsp;&nbsp;Student&nbsp;s2=<span class="keyword">new</span>&nbsp;Student(<span class="number">102</span>,<span class="string">"Ravi"</span>,<span class="number">21</span>);&nbsp;&nbsp;
&nbsp;&nbsp;Student&nbsp;s2=<span class="keyword">new</span>&nbsp;Student(<span class="number">103</span>,<span class="string">"Hanumat"</span>,<span class="number">25</span>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;ArrayList&lt;Student&gt;&nbsp;al=<span class="keyword">new</span>&nbsp;ArrayList&lt;Student&gt;();<span class="comment">//creating&nbsp;arraylist</span>&nbsp;&nbsp;
&nbsp;&nbsp;al.add(s1);<span class="comment">//adding&nbsp;Student&nbsp;class&nbsp;object</span>&nbsp;&nbsp;
&nbsp;&nbsp;al.add(s2);&nbsp;&nbsp;
&nbsp;&nbsp;al.add(s3);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;Iterator&nbsp;itr=al.iterator();&nbsp;&nbsp;
&nbsp;&nbsp;<span class="comment">//traversing&nbsp;elements&nbsp;of&nbsp;ArrayList&nbsp;object</span>&nbsp;&nbsp;
&nbsp;&nbsp;<span class="keyword">while</span>(itr.hasNext()){&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;Student&nbsp;st=(Student)itr.next();&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(st.rollno+<span class="string">"&nbsp;"</span>+st.name+<span class="string">"&nbsp;"</span>+st.age);&nbsp;&nbsp;
&nbsp;}&nbsp;&nbsp;
&nbsp;}&nbsp;&nbsp;
}</pre>
<h2><span style="color: #000000;">The ArrayList data structure</span></h2>
The <em>array</em> is the fundamental data structure built into Java for holding collections of items. Arrays provide two basic operations: You can retrieve the value at an index, or you can change the value at an index. These are quite similar to the List ADT's <code class="j"><tt>get</tt></code> and <code class="j"><tt>set</tt></code> operations.
<blockquote>
<table style="height: 94px;" width="673">
<thead>
<tr>
<th>array operation</th>
<th>equivalent List ADT operation</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center"><code class="j"><tt>x</tt>&nbsp;=&nbsp;<tt>data</tt>[<tt>i</tt>];</code></td>
<td align="center"><code class="j"><tt>x</tt>&nbsp;=&nbsp;<tt>get</tt>(<tt>i</tt>)</code></td>
</tr>
<tr>
<td align="center"><code class="j"><tt>data</tt>[<tt>i</tt>]&nbsp;=&nbsp;<tt>x</tt>;</code></td>
<td align="center"><code class="j"><tt>set</tt>(<tt>i</tt>,&nbsp;<tt>x</tt>)</code></td>
</tr>
</tbody>
</table>
</blockquote>
This similarity is what inspires the implementation of the List interface using an array to store the data elements. There are other List operations that don't correspond to anything we can do with an array (<code class="j"><tt>add</tt></code> and <code class="j"><tt>remove</tt></code>); but this is a detail that we can hope to overcome. Overall, it seems like an array is a good candidate for implementing the List interface. Java's built-in libraries already include such an implementation; specifically, the java.util package includes the ArrayList class. To use it, you need to include a <code class="j"><strong>import</strong></code> statement at the top of your program definition.
<pre class="frag" style="padding-left: 30px;"><code class="j"><strong>import</strong>&nbsp;<tt>java</tt>.<tt>util</tt>.<tt>ArrayList</tt>;
 </code></pre>
Like the List interface, the ArrayList class is a generic. Inside a method definition, we can declare a <code class="j"><tt>names</tt></code> variable and then assign it to refer to a newly created ArrayList object.
<pre class="frag" style="padding-left: 30px;"><code class="j"><tt>List</tt>&lt;<tt>String</tt>&gt;&nbsp;<tt>names</tt>;
 <tt>names</tt>&nbsp;=&nbsp;<strong>new</strong>&nbsp;<tt>ArrayList</tt>&lt;<tt>String</tt>&gt;();
 </code></pre>
Once we have a way of referring to an ArrayList object, then we can tell it to do things using the ArrayList methods, which necessarily include all the methods in the List interface. Among these is the <code class="j"><tt>add</tt></code> method.
<pre class="frag" style="padding-left: 30px;"><code class="j"><tt>names</tt>.<tt>add</tt>(<em>"Martin"</em>);
 <tt>names</tt>.<tt>add</tt>(<em>"Galloway"</em>);
 </code></pre>
Suppose we want to display all the strings in the ArrayList. List's <code class="j"><tt>size</tt></code> and <code class="j"><tt>get</tt></code> methods are useful for this.
<pre class="frag" style="padding-left: 30px;"><code class="j"><strong>for</strong>(<strong>int</strong>&nbsp;<tt>i</tt>&nbsp;=&nbsp;0;&nbsp;<tt>i</tt>&nbsp;&lt;&nbsp;<tt>names</tt>.<tt>size</tt>();&nbsp;<tt>i</tt>++)&nbsp;{
 &nbsp;&nbsp;&nbsp;&nbsp;<tt>System</tt>.<tt>out</tt>.<tt>println</tt>(<tt>names</tt>.<tt>get</tt>(<tt>i</tt>));
 }</code></pre>
</div>
<h2><span style="color: #000000;">Implementing the ArrayList in Java</span></h2>
implement an <code>arraylist.add()</code> method <strong>using nothing but arrays and an array copy method</strong> but im having trouble doing it . The specification of the method is that the method inserts an element at a specified position and shifts any of the elements currently in the position to the right and add one to the indices expanding the size of the array by one so all elements fit . Someone please help .
<pre class="lang-java prettyprint prettyprinted"><code>    <span class="kwd">private</span> <span class="typ">Object</span> <span class="pun">[]</span><span class="pln"> list</span><span class="pun">;</span>
    <span class="kwd">final</span> <span class="kwd">int</span><span class="pln"> maxObjects </span><span class="pun">=</span> <span class="lit">100</span><span class="pun">;</span>
    <span class="kwd">public</span> <span class="typ">ListOfObjects</span><span class="pun">()</span>
    <span class="pun">{</span><span class="pln">
        list</span><span class="pun">=</span> <span class="kwd">new</span> <span class="typ">Object</span><span class="pun">[</span><span class="pln">maxObjects</span><span class="pun">];</span>
    <span class="pun">}</span>
    <span class="kwd">public</span> <span class="typ">ListOfObjects</span><span class="pun">(</span><span class="typ">Object</span><span class="pun">[]</span><span class="pln">o</span><span class="pun">)</span>
    <span class="pun">{</span><span class="pln">
        list</span><span class="pun">=</span><span class="pln"> o</span><span class="pun">;</span>
    <span class="pun">}</span>
    <span class="kwd">public</span> <span class="kwd">void</span><span class="pln"> add</span><span class="pun">(</span><span class="typ">Object</span><span class="pln"> element</span><span class="pun">,</span><span class="kwd">int</span><span class="pln"> index</span><span class="pun">)</span>
    <span class="pun">{</span>
        <span class="typ">Object</span><span class="pun">[]</span><span class="pln"> newData </span><span class="pun">=</span> <span class="kwd">new</span> <span class="typ">Object</span><span class="pun">[</span><span class="pln">list</span><span class="pun">.</span><span class="pln">length</span><span class="pun">+</span><span class="lit">1</span><span class="pun">];</span>
        <span class="kwd">for</span><span class="pun">(</span><span class="kwd">int</span><span class="pln"> i </span><span class="pun">=</span><span class="lit">0</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> index</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span>
        <span class="pun">{</span><span class="pln">
            newData</span><span class="pun">[</span><span class="pln">i</span><span class="pun">]</span> <span class="pun">=</span><span class="pln"> list</span><span class="pun">[</span><span class="pln">i</span><span class="pun">];</span><span class="pln">
            newData</span><span class="pun">[</span><span class="pln">list</span><span class="pun">]</span> <span class="pun">=</span><span class="pln"> element</span><span class="pun">;</span>
        <span class="pun">}</span>
        <span class="kwd">for</span><span class="pun">(</span><span class="kwd">int</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> index</span><span class="pun">;</span><span class="pln"> i </span><span class="pun">&lt;</span><span class="pln"> list</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span>
        <span class="pun">{
</span><span class="pln">     newData</span><span class="pun">[</span><span class="pln">i</span><span class="pun">+</span><span class="lit">1</span><span class="pun">]</span> <span class="pun">=</span><span class="pln"> list</span><span class="pun">[</span><span class="pln">i</span><span class="pun">];</span>
        <span class="pun">}</span>
    <span class="pun">}</span></code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>3a:Tabe,<h2><strong>Advanced Java Sample Resume</strong></h2>
<p>223E Concord Street, Orlando, Florida. (258) 123 456. adlley@gmail.com.</p>
<h3><strong>Professional Experience :</strong></h3>
<ul>
<li>Seeking a growth oriented and challenging career in software development industry to use my learned skills and experience for better results.</li>
<li>Experienced team player with good communication skills, and has ability to work independently.</li>
<li>Designing and implementation of Programming skills in multi-tier applications using java, J2EE, java scripts.</li>
<li>Involved in software testing and regression testing, defect tracking and clear Quest.</li>
<li>Having knowledge in IBM web sphere Portal/Application server and Tomcat application server.</li>
<li>Good in written and Communication skills.</li>
<li>Strong experience in web application using XML, and also in sequence diagrams and class diagrams.</li>
</ul>
<h3><strong>Technical Strengths :</strong></h3>
<ul>
<li>Technologies : java, J2EE, Junit.</li>
<li>Data bases : Oracle 9i.</li>
<li>Application servers : IBM WebSphere.</li>
<li>Operating systems : Linux, Unix.</li>
</ul>
<h3><strong>Academic Qualifications :&nbsp; &nbsp;</strong></h3>
<ul>
<li>Bachelor of Engineering in Information Technology, University of South Florida, Tampa.</li>
</ul>
<h3><strong>Professional Experience :</strong></h3>
<ul>
<li>Having 3 years experience in developing&nbsp; web application, Ultimate software, Florida.</li>
</ul>
<h3 style="text-align: justify;"><span style="color: #000000;"><strong>Roles and Responsibilities :</strong></span></h3>
<ul>
<li>Designed J2EE patterns like Data Transfer Objects and Data Business Objects.</li>
<li>Developing UI screens with MVC to provide interactive screens.</li>
<li>Involved and maintained post production issues.</li>
<li>Worked on enhancements on change requests.</li>
<li>Implementing Client side and server side validations.</li>
<li>Developed object mapping and converting objects to values.</li>
</ul>
<h3><strong>Accomplishments :</strong></h3>
<ul>
<li>Implemented third party solutions.</li>
<li>Established a team to support regional operations</li>
</ul>
<h3><strong>Advanced Java Sample Resume Tips For Better Resume :</strong></h3>
<ul>
<li>Invest time in highlighting the most relevant skills.</li>
<li>Bold the most recent job titles you have held.</li>
<li>Highlight your Accomplishments and Responsibilities.</li>
<li>Showcase transparency in employment Gaps (if any).</li>
<li>Make it clear in the 'Objectives' that you are qualified for the type of jobs you are applying.</li>
<li>Your resume must showcase the critical competency.</li>
</ul>
<p>Download Advanced JAVA Sample Resume (PDF) Here : Advanced JAVA Sample Resume</p>3b:T216e,<h2><span style="color: #e67e23;"><strong>4 Types of </strong><strong>Event handling</strong></span></h2>
<ul>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#action">Action</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#action-listener">Action Listener</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#value-change-listener">Value change listener</a></span></li>
<li><span style="color: #236fa1;"><a style="color: #236fa1;" href="#phase-listener">Phase listener</a></span></li>
</ul>
<h3><span style="color: #e67e23;"><strong><a id="action"></a>Action</strong></span></h3>
<ul>
<li>This attribute will be used for only the GUI Components like&lt;h:command button&gt; and&lt;h:command link&gt;</li>
<li>This attribute will rise an action event automatically when we click on button or hyperlink and it will take a method name in the respectively managed bean to execute in order to perform the respective action.</li>
<li>It we want to use this attribute in JSF applications to perform event handling, we have to use the following rules while preparing the action method In managed bean component</li>
</ul>
<ol>
<li>The method name must be the same as the method which we have specified in the method expression along with the action attribute</li>
<li>Managed bean method must not have any parameters</li>
<li>Managed bean method must have a string return type and it must return a string value.</li>
</ol>
<ul>
<li>This listener will use a navigation system to identify the target page.</li>
<li>This listener may forward requests to either the same page from where the request is coming or any diff. the page which we configured in faces-config.xml file</li>
</ul>
<h3><span style="color: #e67e23;"><strong><a id="action-listener"></a>Action Listener</strong></span></h3>
<ul>
<li>This attribute will rise action event, it will send a request to faces servlet and it will make faces servlet to perform the respective action and forward request back to the same page from where faces servlet is getting request</li>
<li>It we want to use action listener attribute in JSF application n s then the respective managed bean method must have the following co mentions.</li>
</ul>
<ol>
<li style="list-style-type: none;">
<ol>
<li>Managed bean method name must be matched with the method name which we specified in method expression along with action listener attribute</li>
<li>managed bean method must have &rdquo;action event&rdquo; type as parameter</li>
<li>Managed bean method must have &rdquo;void&rdquo; return type &amp; it must not return any value</li>
</ol>
</li>
</ol>
<ul>
<li>This Listener will not use navigation system, because it will forward request to the same page from where the request is coming.</li>
<li>It will be applicable for the GUI Components like</li>
</ul>
<p>&lt;h:command button&gt; and&lt;h:command link&gt;</p>
<p>&nbsp; <img class="alignnone wp-image-10057" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_22-460x253.png" alt="Screenshot_22" width="595" height="327" /> &nbsp;</p>
<p>&lt;h:command Link value =&rdquo;address details&rdquo; action Listener =&rdquo;#&lt;empBean.displayAddressDetails}&gt;&rdquo;/&gt; &nbsp;</p>
<h3><span style="color: #e67e23;"><strong><a id="value-change-listener"></a>Value change listener</strong></span></h3>
<ul>
<li>This Listener will rise change event, it will send a request to faces servlet and it will make faces servlet to execute the respective managed bean method and forward request to the same JSP page from where the request is coming</li>
<li>If you want to use this listener in JSF applications then we have to use the following co-mentions while preparing managed bean method.
<ul>
<li>Method name must be matched with the method name specified along with Method expression as attribute values to &rdquo;value change listener&rdquo;.</li>
<li>Managed bean method must have &rdquo;change event &rdquo;as parameter</li>
<li>Managed bean method must&nbsp; have &rdquo;void&rdquo; return type &amp; it must not return any value</li>
</ul>
</li>
<li>This Listener will not use navigation system</li>
<li>This Listener will be applicable for the GUI Components like</li>
</ul>
<p>&lt;h:select many check box&gt;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&lt;h:select one menu&gt;</p>
<p>&lt;h:select boolean check box&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p>&lt;h:select many menu&gt;</p>
<p>&lt;h:select one radio&gt;</p>
<p>&lt;h:select many list box&gt;</p>
<p>&lt;h:select one list box&gt;</p>
<p>&nbsp; <img class="alignnone wp-image-10058" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_23-460x305.png" alt="Screenshot_23" width="548" height="362" /> &nbsp;</p>
<h3><span style="color: #e67e23;"><strong><a id="phase-listener"></a>Phase Listener</strong> </span></h3>
<p>In JSF based web appl n it we send a request from client to server then faces servlet will process the request by following request processing life cycle. &agrave;In JSF request processing life cycle includes the phases like restore view, apply Request values, process validations update model values, invoke application &nbsp;and render response <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In JSF based we apps the main purpose of phase listener is to read each &amp; every phase in JSP request process in life cycle and gives notification before and after the at each and every phase <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />If we want to use phase listener in JSF based web appl n we have to follow below steps &nbsp;</p>
<p><span style="color: #e67e23;"><strong>Step-1</strong> <strong>Prepare phase listener implementation class</strong> </span></p>
<p>To prepare phase listener class we have to take on user defined class which must implement class to javax.faces event. Phase listener and implement all the methods of phase listener interface. &agrave;Javax. Faces. Event. Phase listener interface has the following methods</p>
<ol>
<li>Public void before phase(phase event pe)</li>
<li>Public void after phase(phase event pe)</li>
</ol>
<ul>
<li>Public phaseId get phase ID()</li>
</ul>
<p><img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Where before phase() will be executed just before starting each and every phase <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Where after phase() will be executed just after completing each and every phase <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Where get phase Id() will return current&nbsp; phase Id value. Eg: Public class myphaseListener implements phase listener &nbsp;</p>
<p><span style="color: #e67e23;"><strong>Step-2 -</strong> <strong>Configure phase listener implementation class in faces- config.xml</strong> </span></p>
<p>The main intention to configure phase listener implementation class in faces- config.xml file is&nbsp; to give an interaction to faces servlet which class is having implementation for phase listener interface, in order to execute at each and every phase <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />To configure phase listener implementation class in faces- config.xml file, we have to use the following lode &lt;faces-config&gt; &lt;life cycle&gt; &lt;phase- listener&gt;fully qualified listeners&lt;/phase- listener&gt; &lt;/life cycle&gt; &lt;/life config&gt; [for example application on event handling refer hand out provide on 21<sup>st</sup> nov 2013]</p>
<p><img class="alignnone wp-image-10059" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_24-460x262.png" alt="Screenshot_24" width="602" height="341" /> &nbsp; &nbsp;</p>3c:T26b1,<p><strong>Layouts in JSF- Tiles</strong> JSF- Tiles Integration: In case of web applications we have to provide very good user interface to improve look and feel To improve look &amp; feel for the web application we have to organize all the web pages in a standardization manner. <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />To organize web pages in a standard approach, we have to use layout mechanisms in web applications. <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />To provide layout mechanisms in web application we have to use a separate frame work like tiles f/w provided by apache <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Tiles F/W is a commonly used f/w in almost all the web f/w like struts1, struts2,JSF,Spring.. <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />If we want to use tiles F/w in JSF based web appl ns then we have to use the following steps &nbsp; <strong>Step-1 </strong> <strong>Get all the files F/W Specific jar files in web app lib folder</strong> <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Commons- beanutils-1.6 <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Commons- collections-3.2 <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Commons- digester-1.8 <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Commons- loggings-1.0.4 <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Commons- struts &nbsp; <strong>Step-2</strong> <strong>Configure tiles servlef in web. Xml file</strong> The main requirement to Configure tiles servlet in web. Xml file is to load all the files definitions at the time at loading web application i.e at the time of web application &nbsp;deployment i.e at the time at server start up &agrave;In files servlet configuration we have to provide&rdquo; definitions-config&rdquo; initialization parameter with the names and location of files configuration file i.e files-dfts.xml file &nbsp; <strong>Web.xml</strong> &lt; web-app &gt; &lt; servlet &gt; &lt; servlet-name&gt; faces servlet&lt;/ servlet-name&gt; &lt; servlet-class&gt; javax. Faces. Web app. Faces servlef &lt;/ &gt; &lt;add-on-startup&gt;1&lt;/ &gt; &lt; /servlet &gt; &lt; servlet &gt; &lt; servlet name&gt; titles servlet&lt;/ &gt; &lt; servlet-class&gt; org.apach.struts tiles servlet&lt;/ &gt; &lt;init-Param&gt; &lt; param-name &gt;definitions-config&lt;/ &gt; &lt; param-value &gt;/web-inf/tiles-dets.xml&lt;/ &gt; &lt;/init-param&gt; &lt;load-on-startup&gt;2&lt;/ &gt; &lt; servlet-mapping&gt; &lt; servlet name&gt; faces servlet&lt;/&gt; &lt;url-pattern&gt;*.add&lt;/&gt; &lt; /web-app &gt;</p>
<ul>
<li>Where faces servlet load-on-startup values should be less when compared with tiles servlet&rsquo;s load- on- startup value, because we must load faces servlet first then only/ tiles servlet.</li>
</ul>
<p>&nbsp; <strong>Step-3</strong> <strong>Prepare layout page</strong> The main purpose to prepare layout page is to define a particular template in order to organize all the web pages</p>
<ul>
<li>In web appl n, we will use the following templates commonly to organize web pages</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-10062" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_25-460x183.png" alt="Screenshot_25" width="527" height="209" /> &nbsp; &nbsp;</p>
<ul>
<li>To prepare layout page with the either of the above templates we have to use files tag library and JSF care tag library</li>
</ul>
<p>&lt;tiles: insert attribute=&rdquo;logical- name&rdquo; flush=&rdquo;false&rdquo;/&gt;</p>
<ul>
<li>Where logical- name may be &ldquo;HEADER&rdquo;, &rdquo;MENU&rdquo;, &rdquo;Footer&rdquo;, &rdquo;Body&rdquo;..&lt;f:Subview id=&rdquo;--&rdquo;&gt;</li>
</ul>
<p>&lt;/f:Subview&gt;</p>
<ul>
<li>Where id attribute will takes an identify for the current sub view</li>
</ul>
<p>&nbsp; <strong>Layout.JSP</strong> &lt;%@taglib prefix=&rdquo;f&rdquo;url=&rdquo;http://java.sun.com/JSF / cone%&gt; &lt;%@taglib prefix=&rdquo;files&rdquo;url=&rdquo;WEB-INIF/Struts-files.ltd&rdquo;%&gt; &lt;html&gt; &lt;body &gt; &lt;center &gt; &lt;table height =&rdquo;100%&rdquo;width=&rdquo;100%&rdquo;&gt; &lt;tr height =&rdquo;20%&rdquo;&gt; &lt;td calspan =&rdquo;2&rdquo;align=&rdquo;center&rdquo; bg color=&rdquo;maroon&rdquo;&gt; &lt;/f:subview id=&rdquo;header&rdquo;&gt; &lt;files: insert attribute=&rdquo;HEADER&rdquo;flush=&rdquo;false&rdquo;/ &gt; &lt;/f:subiview &gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr height =&rdquo;70%&rdquo;&gt; &lt;td width =&rdquo;20%&rdquo;bg color=&rdquo;light blue&rdquo;&gt; &lt;f:subiview id=&rdquo;menu&rdquo; &gt; &lt;files: insert attribute=&rdquo; menu &rdquo;flush=&rdquo;false&rdquo;/ &gt; &lt;/f:subiview &gt;&lt;/td&gt; &lt;td bg color=&rdquo;light yellow&rdquo;&gt; &lt;/f:subiview id =&rdquo;body&rdquo;&gt; &lt;files: insert attribute=&rdquo; BODY &rdquo;flush=&rdquo;false&rdquo;/ &gt; &lt;/f:subiview &gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr height =&rdquo;10%&rdquo;&gt; &lt;td colspan=&rdquo;2&rdquo; bg color=&rdquo;blue&rdquo;&gt; &lt;/f:subiview id =&rdquo;footer&rdquo;&gt; &lt;files: insert attribute=&rdquo; FOOTER &rdquo;flush=&rdquo;false&rdquo;/ &gt; &lt;/f:subiview &gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/html&gt; &nbsp; <strong>Step-4</strong> <strong>Prepare Tiles JSP page</strong> In JSF-Tiles applications, each and every JSP Page is treated as a file, we can prepare only no. of JSP pages as per the applicationn requirement like header. JSP, footer.JSP, Log inform. JSP-- &nbsp; <strong>Step-5</strong> <strong>Prepare Tiles Configuration file</strong> The main purpose of files configuration file is to provide as the file def ns which we are going to use in web appl ns</p>
<ul>
<li>To prepare files definition in files Configuration file we have to use the following tags</li>
</ul>
<p>&lt;files-definitions&gt; &lt; definitions name=&rdquo;--&rdquo;page=&rdquo;/--&rdquo;&gt; &lt; put name=&rdquo;--&rdquo;value=&rdquo;/--&rdquo;&gt; &lt;/definition&gt; &lt;definition name=&rdquo;--&rdquo;extends=&rdquo;/--&rdquo;&gt; &lt; put name=&rdquo;--&rdquo;value=&rdquo;/--&rdquo;&gt; &lt;/definition&gt; &lt;/files-definitions&gt;</p>
<ul>
<li>Where &rdquo;name&rdquo; attribute in&lt; definitions &gt;tag will take logical name to the definition.</li>
<li>Where &rdquo;page&rdquo; attribute in&lt; in definitions &gt;tag will take logical jsp page</li>
<li>Where &lt;put&gt; tag will provide mapping bet n file logical name&amp; files JSP Page.</li>
<li>Where &rdquo;name&rdquo; attribute in&lt; put &gt;tag will take the logical name which are defined in files-dets.xml file and &ldquo;value&rdquo; attribute will take files JSP Page</li>
<li>In files configuration file, we can extend one def n to another def n s by using &ldquo;extends&rdquo; key word like java in heritance.</li>
</ul>
<p>&nbsp; <strong>Step-6</strong> <strong>In clued tiles defines into JSP Pages</strong> To include files defines into a JSP Page, we have to use the following tag from this tag library. &lt;files: insert definition=&rdquo;--&rdquo;flush=&rdquo;false&rdquo;/&gt; Where &rdquo;definition&rdquo; attribute will take logical names of the def n available in files configurations file Extract struts.jar<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> meta-INF<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />tlds(get struts &ndash; files led) and kee in WEB. INF Folder) &nbsp;</p>
<h2><strong>RICH Faces</strong></h2>
<ol>
<li>RICH Faces is an advanced UI Component f/w for easily integrating Ajax capabilities into JSF Application?</li>
<li>RICH Faces is designed on the basis of Ajax, it will improve the other areas of JSF like component Development, performance,..</li>
<li>Rich faces are available in 2 component libraries Ajax controllers Rich faces components</li>
<li>To get the above two libraries in xhtml pages are in JSP Pages, we have to use the following user are name spaces.</li>
</ol>
<p>Ajax: <a href="http://rich">http://rich</a> faces. Org/arj Rich faces<a href="http://rich">http://rich</a> faces. Org/rich</p>
<ol start="5">
<li>Required jars</li>
</ol>
<p>Commons-beanu fils-1.7.0 jar Commons-collections-3.1 jar Commons-digestere-1.8 jar Commons-e1-1. 0 jar Commons-email-1. 0 jar Commons-file upload-1. 0 jar Commons-lang-2.1 jar Commons-logging-1.0.4 jar Commons-calidator-1.3.1 jar CSS Parser.0.9.5 jar Lightlight-1.0. jar Jste-1.0. jar Rich faces-components-api-4.3.4. final.jar Rich faces-components-ui-4.3.4. final.jar Rich faces-core-api-4.3.4. final.jar Rich faces-core-api-4.3.4. final.jar Sac-1.3.jar Ojb bc6.jar &nbsp; &nbsp; &nbsp;</p>3d:T1733,<h2><strong>JSF Basic GUI Components</strong></h2>
<p>&nbsp; In JSF based web appl ns we will use the following components to prepare user interface &lt;h: input text&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />text field &lt;h: input secrete&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />password field &lt;h: select many check box&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />group of check boxes &lt;h: select&nbsp; Boolean check box&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />single check box &lt;h: select&nbsp; many list box&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />list box with multiple selections &lt;h: select&nbsp; one list box&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />list box with single. Selection &lt;h: select&nbsp; many menu&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select&nbsp; box with multiple selection &lt;h: select&nbsp; one menu&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select&nbsp; box with single selection &lt;h: select&nbsp; one radio&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />group of radio buttons with single&nbsp; selection &lt;h:text area&gt;&agrave;text area &lt;h:command button&gt;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />button, submit button, reset button &lt;h:command link&lt;&gt; <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />There are two ways to provide values to the GUI Components like check boxes, radio buttons, list boxes, select boxes.</p>
<ol>
<li>Static values</li>
<li>Dynamic values</li>
</ol>
<ul>
<li>To provide static values, we have to use the following tags</li>
</ul>
<p>&lt;h: select many check box id=&rdquo;sequel&rdquo; value=&rdquo;#{student bean. sequal}&rdquo;&gt; &lt;f: select item item label=&rdquo;BSC&rdquo;item value=&rdquo;BSC&rdquo;/&gt; =&rdquo;MCA&rdquo; =&rdquo;MCA&rdquo;/&gt; &lt;h: select many check box&gt;</p>
<ul>
<li>In bean component</li>
</ul>
<p>Private list&lt;string&gt;sequel; Set()&mdash; Get()&mdash;</p>
<ul>
<li>To provide dynamic values, we have to use the following lags</li>
</ul>
<p>&lt;h: select many check box id=&rdquo;squeal&rdquo; value=&rdquo;#{student bean. Squeal}&rdquo;&gt; &lt;f:select items value=&rdquo;#&rdquo;{student bean. qual}&rdquo;&gt; &lt;/h:select many check box&gt;</p>
<ul>
<li>In managed bean component</li>
</ul>
<p>Public class student bean{ Private static array list&lt;select item&gt;qual; Private list&lt;string&gt; squals; Static { Select item item1=new select item(&ldquo;BSC&rdquo;,&rdquo;BSC&rdquo;); (&ldquo;MCA&rdquo;,&rdquo;MCA&rdquo;); (&ldquo;PHD&rdquo;,&rdquo;PH&rdquo;); Qual=new array list&lt;select item&gt;(); Qual.and(item1); (item2); (item3); } Public Arraylist&lt;select item&gt;getqual(){ Return qual; } Set qual(){---} Set qual(){---} &nbsp; <strong>Data table<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />&nbsp;</strong>This GUI Component can be used to display data <strong>Syntax<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />&nbsp;</strong>&lt;h: data table value=&rdquo;--&rdquo;var=&rdquo;--&rdquo;style class=&rdquo;--&rdquo;header class=&rdquo;--&rdquo; row classes=&rdquo;--&rdquo;column classes=&rdquo;--&rdquo;&gt; &lt;h:column&gt; &lt;f:facet name=&rdquo;--&rdquo;&gt;value&lt;/f:facet&gt; &lt;/h:column&gt; ------ &nbsp; &lt;/h: data table &gt;</p>
<ul>
<li>Where&rdquo; value&rdquo; attribute in&lt;h: data table &gt;tag will take JSF expression in order to refer a property in bean component to get data. In Bean component, the respective property should be either collection or object[]</li>
<li>Where &rdquo;var&rdquo; attribute will take a variable to store element object reference at each and every iteration</li>
<li>Where &rdquo;style class&rdquo; attribute will take a class name defined in the respective css file, which is representing table configurations.</li>
<li>Where &rdquo;header class&rdquo; attribute will take a class name defined in the respective css file, which is representing table configurations</li>
<li>Where &rdquo;column classes&rdquo; attribute will take a class name provided in the respective css file, which is representing table configurations</li>
<li>Where &rdquo;row classes&rdquo; attribute will take a class name defined .css file, which is representing rows configurations</li>
</ul>
<p>&nbsp; &nbsp; &nbsp;</p>3e:T1942,<h2><strong>CONVERTERS</strong></h2>
<p>In ISF frame work the main purpose of converters is to convert the data from one to another type and from one format to another format</p>
<ul>
<li>In JSF, Validators can be utilized for only i/p UI Components only but converters will be utilized for both i/p and o/p UI Components</li>
<li>To perform conversions JSF has provided the following 2 types of converters.</li>
</ul>
<ol>
<li>&lt;f:convert number&gt;</li>
<li>&lt;f:convert date time&gt;</li>
</ol>
<p>&nbsp; <strong>&lt;f:convert number&gt;</strong> This log or converter is used to convert a number from one format to another format <strong>Syntax&nbsp;</strong>&lt;f:convertnumber type=&rdquo;&rdquo;mininteger digits=&rdquo;--&rdquo; max integer digits=&rdquo;--&rdquo; minFraction digits=&rdquo;--&rdquo; max function digits=&rdquo;--&rdquo;currency symbol=&rdquo;--&rdquo;&gt; <strong>Type &nbsp;</strong>It will take number type like number or currency &nbsp; <strong>Mininteger Digits &nbsp;</strong>It will take a number representing minimum number of integer digits &nbsp; <strong>Max integer digits &nbsp;</strong>It will take a number representing maxm number of integer digits &nbsp; <strong>Minfaction digits &nbsp;</strong>It will take a number representing minimum number of fraction digits &nbsp; <strong>Max faction digits &nbsp;</strong>It will take a number representing mamm number of fraction digits &nbsp; <strong>Currency symbol &nbsp;</strong>It will take Currency symbol like$</p>
<ul>
<li>This attribute will be used when we specify type attribute value is currency</li>
</ul>
<p>&nbsp; <strong>&lt;f:convert date time&gt;</strong> This tag or converter can be used to convert date from one format to another format <strong>Syntax&nbsp;</strong>&lt;f:convert date time type=&rdquo;--&rdquo;pattern=&rdquo;--&rdquo; Data style=&rdquo;--&rdquo;time style=&rdquo;--&rdquo;/&gt; <strong>Type &nbsp;</strong>It will take date type like date are time or both <strong>Pattern &nbsp;</strong>It will take a particular Pattern to allow &nbsp;date or time <strong>Data style&nbsp;</strong>It will take the value like short, medium, long full, default.<strong>&nbsp;</strong> <strong>&nbsp;</strong></p>
<h2><strong>Custom converters</strong></h2>
<p>If the application requirement is not achieved with predefined converters then JSF has provided an environment to provide user defined converters called as custom converters</p>
<ul>
<li>TO prepare custom converters we have to use the following method</li>
</ul>
<ol>
<li>Public object get as object(faces context fc. UI Component string val)</li>
<li>Public string getns string(faces context fc,UI Component uc string val)</li>
</ol>
<ul>
<li>Where get as object method will be executed at the time of string value from UI Component to the respective property in managed bean in order to convert the data.</li>
<li>Where get as string method will be executed at the time of retrieving value from managed bean property to UI out put component</li>
</ul>
<p>Public class my converter impotents&nbsp; converter{ Public object get as object(faces context fc, UI Component uc, string val) { Dss } Public string get as string(faces context fc, UI Component uc object var) { Dss } } <strong>:</strong> In ISF frame work the main purpose of converters is to convert the data from one to another type and from one format to another format</p>
<ul>
<li>In JSF, Validators can be utilized for only i/p UI Components only but converters will be utilized for both i/p and o/p UI Components</li>
<li>To perform conversions JSF has provided the following 2 types of converters.</li>
</ul>
<ol>
<li>&lt;f:convert number&gt;</li>
<li>&lt;f:convert date time&gt;</li>
<li>&nbsp;</li>
</ol>
<p><strong>&lt;f:convert number&gt;</strong> This log or converter is used to convert a number from one format to another format <strong>Syntax&nbsp;</strong>&lt;f:convertnumber type=&rdquo;&rdquo;mininteger digits=&rdquo;--&rdquo; max integer digits=&rdquo;--&rdquo; minFraction digits=&rdquo;--&rdquo; max function digits=&rdquo;--&rdquo;currency symbol=&rdquo;--&rdquo;&gt; <strong>Type &nbsp;</strong>It will take number type like number or currency <strong>Mininteger Digits &nbsp;</strong>It will take a number representing minimum number of integer digits <strong>Max integer digits &nbsp;</strong>It will take a number representing maxm number of integer digits <strong>Minfaction digits &nbsp;</strong>It will take a number representing minimum number of fraction digits <strong>Max faction digits &nbsp;</strong>It will take a number representing mamm number of fraction digits <strong>Currency symbol &nbsp;</strong>It will take Currency symbol like$</p>
<ul>
<li>This attribute will be used when we specify type attribute value is currency</li>
</ul>
<p><strong>&lt;f:convert date time&gt;</strong> This tag or converter can be used to convert date from one format to another format <strong>Syntax&nbsp;</strong>&lt;f:convert date time type=&rdquo;--&rdquo;pattern=&rdquo;--&rdquo; Data style=&rdquo;--&rdquo;time style=&rdquo;--&rdquo;/&gt; <strong>Type &nbsp;</strong>It will take date type like date are time or both <strong>Pattern &nbsp;</strong>It will take a particular Pattern to allow &nbsp;date or time <strong>Data style &nbsp;</strong>It will take the value like short, medium, long full, default.<strong>&nbsp;</strong> <strong>&nbsp;</strong> <strong>&nbsp;</strong></p>
<h2><strong>Custom converters</strong></h2>
<p>If the application requirement is not achieved with predefined converters then JSF has provided an environment to provide user defined converters called as custom converters</p>
<ul>
<li>TO prepare custom converters we have to use the following method</li>
</ul>
<ol>
<li>Public object get as object(faces context fc. UI Component string val)</li>
<li>Public string getns string(faces context fc,UI Component uc string val)</li>
</ol>
<ul>
<li>Where get as object method will be executed at the time of string value from UI Component to the respective property in managed bean in order to convert the data.</li>
<li>Where get as string method will be executed at the time of retrieving value from managed bean property to UI out put component</li>
</ul>
<p>Public class my converter impotents&nbsp; converter{ Public object get as object(faces context fc, UI Component uc, string val) { Dss } Public string get as string(faces context fc, UI Component uc object var) { Dss } }</p>3f:T1798,<p><strong>ABC.PROPERTIES</strong> Sid= student id Sname-student name Saddr-student address Semail-student email Smobile-student mobile Button=add student Javax.faces. validator.&nbsp; Regexvalidator. Not.matched- detail Value must be provided in &ldquo;{o}&rdquo; format Sid-validation-msg=student id must be started with dss &nbsp; <strong>Index.html</strong> &lt;html&gt; &lt;head&gt; &lt;meta http-equal=&rdquo;Refresh&rdquo; context=&rdquo;2; url=http://local host:1010/ Jsf2validations app/student add form.dss&rdquo;&gt; &lt;head&gt; &lt;body&gt; &lt;h1&gt;Application is loading &lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; &nbsp; <strong>Student add form.jsp</strong> &lt;%@laglib prefix=&rdquo;f&rdquo;url= &lt;%@&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &rdquo;h&rdquo; &lt;html&gt; &lt;f:view&gt; &lt;h1&gt;soft pvt ltd&lt;/h1&gt; &lt;h2&gt;student add form&lt;/h2&gt; &lt;h:form&gt; &lt;h:panel Grid columns=&rdquo;3&rdquo; &gt; &lt;h:output text value=&rdquo;#{msg.sid}&rdquo;/&gt; &lt;h: input text id=&rdquo;sid&rdquo; value =&rdquo;#. { student bean.sid}&rdquo; Required=&rdquo;true&rdquo; required message=student IN is required&rdquo;&gt; &lt;f:validator validator In=&rdquo;sid validator&rdquo;/&gt; &lt;/h: input text&gt; &lt;h:message for=&rdquo;sid&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. sname}&rdquo;/&gt; &lt;h: input text id=&rdquo;s name&rdquo; value =&rdquo;#. { student bean. name }&rdquo; Required=&rdquo;true&rdquo; required message=student name is required&rdquo;&gt; &lt;/h:input text&gt; &lt;h:message for=&rdquo;sname&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. saddr}&rdquo;/&gt; &lt;h: input text id=&rdquo;s addr&rdquo; value =&rdquo;#. { student bean. naddr }&rdquo; Required=&rdquo;true&rdquo; required message=&rdquo;student address is required&rdquo;&gt; &lt;h: message for=&rdquo;saddr&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. semail}&rdquo;/&gt; &lt;h: input text id=&rdquo;s email&rdquo; value =&rdquo;#. { student bean. semail }&rdquo; Required=&rdquo;true&rdquo; required message=&rdquo;student email is required&rdquo;&gt; &lt;h: message for=&rdquo;semail&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. s mobile}&rdquo;/&gt; &lt;h: input text id=&rdquo;s mobile&rdquo; value =&rdquo;#. { student bean. S mobile }&rdquo; Required=&rdquo;true&rdquo; required message=&rdquo;student mobile required&rdquo;&gt; &lt;f:validate Ragex pattern=&rdquo;/d{2}-/d{10}$&rdquo;/&gt; &lt;/h:input text&gt; &lt;h: message for=&rdquo;smobile&rdquo;/&gt; &lt;h:command button value=&rdquo;#{msg. button}&rdquo;action=#{student bean. add}&rdquo;/&gt; &lt;/h:panel Grid&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/body&gt; &lt;/html&gt; &nbsp; <strong>Success.jsp</strong> &lt;%@laglib prefix=&rdquo;f&rdquo;prefix=&rdquo;h&rdquo; &lt;html&gt; &lt;body&gt; &lt;f:view&gt;&lt;h1&gt;student Registration success&lt;/h1&gt;&lt;/fiview&gt; &lt;/body&gt; &lt;/html&gt; &nbsp; <strong>Studentbean.java</strong> Package com. soft; Public class student bean{ Private string sid; Private string sname; Private string saddres; Private string semail; Private string smobile; Private string saddres; //provide setter()&amp;getter() Public string add(){ Return&rdquo;success&rdquo;; } } &nbsp; <strong>SIDVALIDATOR.JAVA</strong> Package com.durgasoft; Import java.util.x; Import java. faces. application. applicaiton; Import java. faces. application. facesnessage; Import java. faces. Component.uicomponent; Import java. faces. Context.faces context; Import java. faces. Validator, validator; Import java. faces. Validator, validator exception; Public class SID validator implements validator{ Public Void validate(faces context tc,UI Component ue,object val) Throws validate exception{ String sid=(string)val; If(!sid.strtswith(DSS-&ldquo;)){ Faces message fm=new faces message(); Application application=fc.get application(); String prop-path=application. Get message bundle(); Resource bundle rb=resource bundle. get bundle(prop-path); Strubg err-msg=rb.get string(&ldquo;sid-validation-msg&rdquo;); Fm.set detail.(err-msg); Throw new validate exception (fm); } } &nbsp; <strong>Faces-config.xml</strong> &lt;faces-config&hellip;.. -----xsd&gt; &lt;managed-bean&gt; &lt;managed-bean-name&gt;student bean&lt;/managed-bean-name&gt; &lt;managed-bean-scope&gt;session&lt;/&gt; &lt;managed-bean&gt; &lt;navigation rule &gt; &lt;from-view-id&gt;/student add from.jsp&lt;/&nbsp; &gt; &lt;navigation case &gt; &lt;from-outcome&gt;success&lt;/&nbsp;&nbsp;&nbsp; &gt; &lt;to-view-id&gt;/success.jsp&lt;/&nbsp;&nbsp;&nbsp; &gt; &lt;/navigation case &gt; &lt;/navigation rule&gt; &lt;validator&gt; &lt;validator-id&gt;sid validator&lt;/&nbsp;&nbsp; &gt; &lt;validator-class&gt;com. soft.SID Validator&lt;/&nbsp;&nbsp; &gt; &lt;/validator&gt; &lt;application&gt; &lt;resource-bundle&gt; &lt;base-name&gt;abc&lt;/&nbsp; &gt; &lt;var&gt;msg&lt;/&nbsp; &gt; &lt;/resource-bundle&gt; &lt;message- bundle &gt;abc&lt;/message- bundle &gt; &lt;/application &gt; &lt;/faces-config &gt; <strong>Web.xml</strong> &nbsp; &nbsp; &nbsp; <strong>Step2 -&nbsp;</strong>&nbsp;<strong>Configure user- defined converter class in faces &ndash; config.xml file</strong> &lt;faces- config&gt; --------- &lt;Converter&gt; &lt;converter -id&gt;converter logical name&lt;/&nbsp; &gt; &lt;converter-class&gt;fully qualified converter class&lt;/&nbsp; &gt; &lt;/converter&gt; ----- &lt;/faces-config&gt; <strong>&nbsp;</strong><strong>&nbsp;</strong> <strong>Step-3</strong> <strong>Use. User- defined converter in both i/p and o/p UI Component</strong> To use converter in i/p and o/p UI Components wl have to use the following tag &lt;f:converter conver ID=&rdquo;--&rdquo;/&gt; Where &ldquo;converter Id&rdquo; attribute will take logical name of the converter class which we provided in [for example appl n on JSF data table, GUI Components &amp; converters refer hand out given o n16 th Nov 2013] &nbsp; &nbsp;</p>40:T19dc,<h2><strong>Frame work</strong></h2>
<p>As [art of enterprise application development, it is very common and frequent to use the service like 118 n, validations, exception handling, conversions, tag libraries,</p>
<ul>
<li>As part of enterprise application development, to provide all the above generic services explicitly at each and every module, developers may get burden.</li>
<li>To overcome the above problems, we have to use some third party products called as &lsquo;frame works&rsquo;.</li>
</ul>
<p><strong>Def 1 - </strong>Frame work is a per &ndash;fabricated s/w components that developers can reuse , share and customize in order to simplify enterprise application development <strong>Def 2 -</strong> Frame work is semi implemented application , it will &nbsp;env. To design enterprise application in simplified manner <strong>Def 3 -</strong> Frame work is a collection of tools and API, which will simplify the enterprise application development. In&nbsp; enterprise application development, frame work will provide the following advantages</p>
<ol>
<li>Able to provide he generic services like validations, 118N, Exception handling&mdash;predefined</li>
<li>Able to reduce development type</li>
<li>Able to reduce development cost</li>
<li>Able to improve productivity</li>
<li>Able to provide standard flow at execution</li>
</ol>
<p><img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />There are 2 types of frame works</p>
<ol>
<li>Web frame works</li>
<li>Application frame works</li>
</ol>
<p>&nbsp; <strong>Q) What is the diff. bet n web frame works and application frame works</strong> <strong>A)</strong> Web frame works will provide very good to design and executed only web appl n. <strong>Ex&nbsp;</strong>&nbsp;Struts, JSF, XULONK 2 and so on Application frame works will provide very good env to design and execute any type at JAVA/J2EE Application <strong>Ex&nbsp;</strong>Spring frame works &nbsp; <strong>Q) What are the difference bet n struct and JSF?</strong> <strong>A)</strong> <strong>1) &nbsp;</strong>Both struts and JSF are based web application frame works, where&nbsp; struts is controller layered frame works but JSF is view layered frame works <strong>2)</strong> Struts f/w is very good in the area at data validations Exception handling and layout mechanism, but JSF is not good in these areas. <strong>3)</strong> Event handling is very good in JSF F/W but which is not available in struts f/w <strong>Note -&nbsp;</strong>To get even handling in struts based web application we have to use either java script are Ajax explicitly. <strong>4)</strong> JSF Is able to have both client side user interface and server side user interface, but struts, is able to have only client side UI <strong>Note -&nbsp;</strong>JSF Is able to create a component tree w.r.to the user forms[view j at servers side to represent each and every GUI component available in the respective from. Here component tree is treated as server side user inter face <strong>5)</strong> In struts f/w all the GUI Components are state but in JSF F/W all the GUI Components are stateful <strong>6)</strong> Component tag library is no good in struts f/w but component tag library is very good in JSF frame works <strong>7)</strong> Response Rendering mechanisms are very good in case at JSF. but which are not available in struts frame works <strong>8)</strong> Data Conversions are not good in struts f/w, but which are very good in JSF F/W <strong>Note -</strong> In JSF F/W it&nbsp; is possible to perform customization over data conversions. &nbsp; &nbsp; <strong>Q) What are the differences bet n spring f/w and JSF f/w?</strong> <strong>A&nbsp;</strong> <strong>&nbsp;1)</strong> Spring f/w is an application f/w, it will provide environment to design and execute any type at Java/j2 EE Applications but JSF f/w will provide exe. To design and execute only web applications. <strong>2)</strong> In spring f/w only web module is following MVC design pattern, but, JSF frame works is following MVC design pattern completely. <strong>3)</strong> Component tag library is not good n spring f/w but&nbsp; which is very good in JSF f/w <strong>4)</strong> Spring f/w has provided inbuilt support to integrate explicit applications like JDBC, Hibernet, EJBs,&hellip;.But JSF is not providing inbuilt support to integrate the specified explicit application &nbsp; <strong>JSF</strong></p>
<ol>
<li><strong>Home</strong>
<ul>
<li>&nbsp;Java community process[Experts from IBM,SUN,..]&nbsp;SUN Me system&nbsp;Macle corporation</li>
</ul>
</li>
</ol>
<ol start="2">
<li><strong>Type</strong>
<ul>
<li>&nbsp;web application f/w</li>
</ul>
</li>
<li><strong>Objective</strong>
<ul>
<li>&nbsp;To Simplify and accelerate web app1</li>
</ul>
</li>
<li><strong>Open/licensed</strong>
<ul>
<li>&nbsp;open source s/w</li>
</ul>
</li>
<li><strong>Initial version</strong>
<ul>
<li>&nbsp;JSF 1.0[2004,March]</li>
</ul>
</li>
<li><strong>Used version</strong>
<ul>
<li>JSF1.2[2006,May ]</li>
</ul>
</li>
<li><strong>Latest version</strong>
<ul>
<li>JSF2.x[2011 ]</li>
</ul>
</li>
<li><strong>Code supported </strong>
<ul>
<li>IBM</li>
</ul>
</li>
<li><strong>Designed plat form</strong>
<ul>
<li>&nbsp;JAVA, Servlet, JSPS</li>
</ul>
</li>
</ol>
<p>&nbsp; <strong>Q) JSF, IS Technology or frame work?</strong> <strong>A:</strong> JSF 1.0, JSF1.1 version are f/w s, They are not the part of J2EE Technologies. * JSF 1.2 version on wards it was included in J2EE Technologies. *JSF 1.0 AND JSF1.1 are frame work but JSF 1.2 and JSF 2.x are Technologies Java EE5&nbsp;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> JSF 1.2&hellip; Java EE6&nbsp;<img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> JSF 2.x &hellip;</p>
<ul>
<li>JSF is an abstraction provides by SUN, but it was implemented in two implementations.</li>
</ul>
<p>1.SUN RI(Reference implementation)(by sun) 2.My Faces (by Apache)</p>
<ul>
<li>JSF Component implementation are provided by some 3<sup>rd</sup> parley org.</li>
</ul>
<ol>
<li>Prime Faces</li>
<li>Rich Faces</li>
<li>ICE Faces</li>
</ol>
<p>&nbsp; <strong>JSF Services</strong></p>
<ol>
<li>I 18 N</li>
<li>Validations</li>
<li>Convertors</li>
<li>Event Handling</li>
<li>Rend kit</li>
<li>Components tag library</li>
</ol>
<p>&nbsp; &nbsp; &nbsp; &nbsp;</p>41:T37f1,<h2>&nbsp;<strong>Faces servlet&nbsp;</strong></h2>
<p>In general in MVC based web appl? The mole of the controller is</p>
<ol>
<li>Pick of the request from client</li>
<li>Identify model component</li>
<li>Perform model component loading instantiation data population</li>
<li>Access application logic</li>
<li>Identify target view page</li>
<li>Forward request to target view page</li>
</ol>
<ul>
<li>JSF is MVC based web application f/w, it has provided javax.feices webapp faces serve let as. Controller</li>
<li>JSF frame work has provided faces servlet as an implementation class to javax. Servlet. Servlet inter face</li>
<li>In JSF, FACE SERVLET has provided the implementation for the following methods from servlet interface</li>
<li>public void init (servlet config config)throws servlet exception</li>
<li>public void service(servlet request , servlet response ) throws servlet exception, ID exception</li>
<li>public servlet config get servlet config get()</li>
<li>public String Get Servlet Into()</li>
<li>public void destroy()</li>
</ul>
<p><img class="alignnone wp-image-9975" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_924-460x403.png" alt="Screenshot_9" width="515" height="450" /></p>
<h2>&nbsp;</h2>
<h2><strong>Above diagram</strong></h2>
<ul>
<li>When we start the server the main job of the container is to recognize each and every web application and it will prepare a separate servlet context object for each and every web app.</li>
<li>While recognizing web app container will identify web.xml file then container perform web.xml file loading. Parsing and reading the content.</li>
<li>If any application level data is identified then container will sore that data in servlet context objects</li>
<li>while reading web.xml file content, it container identify &ldquo;load on startup&rdquo; configuration under any servlet then containers will perform that servlet loading instantiation and initialization at the time at servlet start up only</li>
<li>In JSF based web application, containers will identify startup configuration under faces servlet configuration with this will search for javax faces web app. Faces servlet class file under classes folder if it is not available then container will search for it&nbsp; all this jar files provided in &ldquo;lib&rdquo; folder</li>
<li>In the above context container will identify faces servlet under JSF- ape.jar file then container perform face servlet loading instantiation and initialization at the time of server stat up</li>
<li>In faces servlet initialization faces servlet will recognize faces config xml file under WEB-INF folder then faces servlet will perform faces &ndash; config .xml file loading parsing</li>
<li>After faces- config.xml file parsing .faces servlet will prepare &ldquo;lifecycle&rdquo; object</li>
<li>After the server startup we have to access a page at client browser, we have to provide data in respective fields and we have to submit request from client browser. To server or any hyperlink or by selecting check boxes or radio buttons. Etc</li>
<li>When request is submitted to server container will identify the requested resource is faces servlet through web.xml file and container will execute service method of faces servlet</li>
<li>When container bypass request to faces servlet, faces servlet will remark a separate object with the present request called as &ldquo;faces context&rdquo; object to store the data which is associated with current request.</li>
<li>After preparing &rdquo;faces context&rdquo; object container will invoke life cycle object where lifecycle object will process the request by following &rdquo;JSF Request processing lifecycle&rdquo;</li>
</ul>
<ol>
<li>Restore view</li>
<li>Apply request values</li>
</ol>
<ul>
<li>Process validates</li>
</ul>
<ol>
<li>Update model</li>
<li>Invoke application</li>
<li>Render response</li>
</ol>
<p>&nbsp; <strong>I) Restore view</strong></p>
<ol>
<li>This phase will check whether the current request is fore any resource or action. If the current request is for any resource then faces servlet will identify the requested resource and by pass the flow of execution directly or render response phase</li>
<li>&nbsp;IF the present request is for any particular action then faces servlet will perform the following actions</li>
</ol>
<p>i)Faces servlet will check any &rdquo;component free&rdquo; is existed the present request or not, if any component free is existed then faces servlet will retrieve it ii)It&nbsp; no component tree is existed w.r.to the present request then Faces servlet has to create new component tree. While preparing component tree Faces servlet will perform the following action</p>
<ol>
<li>Faces servlet will create a root node for &lt;f:view&gt; tag in component tree and child nodes for each and every JSF component Which are available in the respective page</li>
<li>Faces servlet will store view id value in &ldquo;UIVIEW ROOT&rdquo; Object which is compiling along with request.</li>
<li>Faces servlet will store all the&nbsp; incoming &rdquo;locate&rdquo; provided by client browser in &ldquo;UIVIEW ROOT&rdquo; node.</li>
<li>if any Validator are configured for UI Components in page then faces servlet will register all the Validator to the components in component tree.</li>
<li>If any converters are configured for UI Component in page then faces servlet will register all the converters to the&nbsp;components in component tree.</li>
<li>It any listeners are configured fore UI Components in page then faces servlet will register all the listeners to component in component tree.</li>
<li>Faces servlet will identify respective model component or Bean component w.r.to the present request through Faces- config.xml file and perform bean loading and instantiation at the time of bean instantiation default values or any initial values will be stored in bean properties these initial values will be set to the respective components in component tree.</li>
<li>After preparing component tree, Faces servlet will store other component tree in faces context object and Http Session Object</li>
</ol>
<p>&nbsp;</p>
<ol>
<li><strong>Apply Request values</strong></li>
</ol>
<ul>
<li>In this phase faces servlet will take request parameter values from request object and it will set request parameter values to the corresponding components in component tree</li>
<li>To set request parameter values to component tree the following method from UI view root:- Public void process Decode()</li>
</ul>
<p>&nbsp;</p>
<ol start="2">
<li><strong>Process Validator</strong></li>
</ol>
<ol>
<li>In this phase, faces servlet will perform the following actions:</li>
<li>Faces servlet will search fore registered Validator at each and every component in component tree</li>
<li>If any Validator is identified at component then faces servlet will execute all the Validator</li>
<li>It any validation error messages are available then it will add validation error messages to &ldquo;Faces context&rdquo; object.</li>
<li>faces servlet will search for the registered convectors at each and every component in component tree</li>
<li>It any convertor is identified then faces servlet will execute that convertors</li>
<li>If any conversion errors are identified then faces servlet will check any error message is available in faces context object,</li>
<li>It any error message is identified then faces servlet will bypass request to &ldquo;Render Response&rdquo; phase directly</li>
<li>It no error message is identified in faces context object then faces servlet will bypass request to the next phase id &ldquo;update model&rdquo; To perform process Validator phase, faces servlet will execute the following method from UI view root class Public void process Validator()</li>
</ol>
<p>&nbsp;</p>
<ol>
<li><strong>Update model:</strong></li>
</ol>
<p>In apply request values phase, all the request parameter values we were set to the components which are available in component tree</p>
<ul>
<li>In this process Validator phase, we have checked weather the data is valid or not</li>
<li>After the data validations and conversions the data which is available in component tree is true data, which we have to use in application logic. To use this data in application logic, first we have to set this data to the properties of model component</li>
<li>Update model phase will set trustable data from component tree to the model properties.</li>
<li>To perform this phase, faces servlet will execute the following method. Public void process updates()</li>
</ul>
<p>&nbsp;</p>
<ol start="4">
<li><strong>INVOKE APPLICATION</strong></li>
</ol>
<p>In this phase, faces servlet will perform the following actions.</p>
<ol>
<li>Faces servlet will get the registered method name from the components like button, hyperlink, check box, radio button,&hellip;from component tree.</li>
<li>Faces servlet will execute the respective method in the respective managed bean component.</li>
<li>&nbsp;If no return value is identified from managed bean component method then faces servlet will bypass request to &ldquo;Render Response&rdquo; phase to maintain the same page at client browser.</li>
<li>It any return value is identified from the respective managed Bean component method then faces servlet will identify the target view page from faces &ndash; config. Xml file and by pass request to &ldquo;Render Response&rdquo; phase to generate response</li>
</ol>
<ul>
<li>To perform this phase, faces servlet will execute the following method</li>
</ul>
<p>Public void process application() &nbsp;</p>
<ol start="5">
<li><strong>Render Response phase&nbsp;</strong></li>
</ol>
<p>In this phase, Faces servlet will convert the respective component tree into the equivalent html or xml or wml and etc formations in order to send response to client browser in html or xml or WML,&hellip;formats</p>
<ul>
<li>It the request is coming from &ldquo;Restore View&rdquo; phase then render response phase will send the requested resource as response to client.</li>
<li>If the request is coming from &ldquo;Process Validator&rdquo; phase then render response phase will get all the validation and conversion error messages from &ldquo;Faces context&rdquo; Object and send the same page as response to client by embedding error messages.</li>
<li>It the request is coming from invoke application phase then render response phase will send the result page as response to client.</li>
<li>To perform this phase, faces servlet will execute</li>
</ul>
<p>&nbsp; <strong>4.Model Component</strong> In MVC based web applications, the main purpose at model component is,</p>
<ol>
<li>To manage application B. logic</li>
<li>To manage users from data in order to perform data validations and conversions,</li>
<li>To manage users from data in order to perform the database operations like insert, update, retrieve,&hellip;.</li>
<li>To transferee the data from controller layer to view later.</li>
</ol>
<p>In JSF web applications, Managed bean component is acting as model To prepare managed bean component in JSF based web applications, we have to use the following guide lines</p>
<ol>
<li>In JSF, Managed bean component should be a POJO class, it should not be extended or implemented from any predefined library.</li>
<li>In JSF based applications, Managed bean class must be public, non abstract and no final</li>
<li>All the properties in managed bean class must match the properties name which we defined along with UI Components in user forms</li>
<li>We must provide set..()methods and getter..() methods for each and every bean property</li>
<li>We have to declare business methods which are registered with the GUI Components like buttons, hyperlinks,&hellip;</li>
<li>If we want to provide any construction in managed Bean class then that construct fore must be &ldquo;Public&rdquo; and &ldquo;O-argument&rdquo;.</li>
<li>Define application logic by declaring business methods</li>
</ol>
<p>&nbsp; <strong>Ex</strong> Public class Login bean { Private string u name; Private string u pwd; Public void set u name(string u name) { This. U name = u name; } Public void set upwd(String upwd) { This. Upwd= upwd; } Public string get u name() { Return u name; } Public string get u pwd() { Return u pwd; } Public string log in() { --- logx--- Return &ldquo;Success&rdquo;; } } &nbsp; <strong>Faces configuration File</strong> The main purpose of&nbsp; faces configuration file is to provide the following con fig&nbsp; details request red by faces servlet.</p>
<ol>
<li>Bean component configuration</li>
<li>Navigation Rules</li>
<li>Validators</li>
<li>Convertors</li>
<li>Listeners</li>
<li>Local configuration.</li>
</ol>
<p>The default name and location of faces configuration file is &ldquo;Faces config.xml&rdquo; file under WEB.INF folder</p>
<ul>
<li>In JSF based web application, it is possible to change the name and location of faces configuration file but we have to configure that name and location under web. In the form of a context parameter</li>
<li>Here context parameter name is fixed is Javax. faces.</li>
</ul>
<p>CONFIG &ndash;FILE &lt;Web - app&gt; &lt;Context. parm&gt; &lt;Param.name&gt;Javax. faces. CONFIG.FILE&lt;/paran-bane&gt; &lt;Param. Value&gt;/WEB- INF/classes /my config.xml &lt;Context param ---- &lt;\web.app&gt;</p>
<ul>
<li>In basic JSF application, we need only bean configuration and navigation configurations in faces configuration file</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />faces-config&gt; ----- &lt;managed- bean&gt; &lt;managed- bean-name&gt; bean logical name&lt;/managed-bean- name&gt; &lt;managed- bean-class&gt; bean fully qualified name&nbsp; &lt;/managed-bean- class &gt; &lt;managed- bean-score&gt;session/application &lt;/managed-bean- scope &gt; &lt;/managed-bean &gt; &lt;navigation mull&gt; &lt;from-view-id&gt;/form page&lt;/from-view-id&gt; &lt;navigation &ndash; case&gt; &lt;from- out come&gt; return value from bean method&lt;/from &ndash; out come&gt; &lt;to- view- id&gt;/ to page &lt;/to-view. id&gt; &lt;\navigation-case&gt; --- &lt;\navigation-mule&gt; --- &lt;/faces-config&gt; &nbsp;</p>42:T15c2,<p><img class="alignnone wp-image-10046" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_21-460x502.png" alt="Screenshot_21" width="332" height="364" /> &nbsp; &nbsp; <strong>Abc. Properties</strong> Sid=student Id Sname=student name Saddre=student address Semail=student email Smobilel=student mobile Button=add student Javax. faces. validator. Regix validator. NOT.MATCHED-Detail= value must be provided in &ldquo;{0}&rdquo;format Sid-validation-msg=student id must be started with Dss &nbsp; <strong>Index.html</strong> &lt;html&gt; &lt;head&gt; &lt;meta http-equiv=&rdquo;Refresh&rdquo; context=&rdquo;2;Ural=http://local host:1010/Jsf2 validations app/student add form .dss&rdquo;&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;application is loading&lt;/h1&gt; &lt;/ body &gt; &lt;/html&gt; &nbsp; <strong>Student add form.jsp</strong> &lt;%@loglib prefix= &rdquo;f&rdquo;url= &lt;%@&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &rdquo;h&rdquo; &lt;html&gt; &lt;/f:view&gt; &lt;h1&gt; soft pvt ltd&lt;/h1&gt; &lt;h2&gt;student add form&lt;/h2&gt; &lt;h:form&gt; &lt;h:panel Grid column=&rdquo;3&rdquo;&gt; &lt;h:output text value=&rdquo;#{msg.sid}&rdquo;/&gt; &lt;h:input text id=&rdquo;sid&rdquo; value=&rdquo;#{student Bean.sid}&rdquo; required=&rdquo;true &rdquo; required message= student IN is required&rdquo;&gt; &lt;f:validator validator Id=&rdquo;sid validator&rdquo;/&gt; &lt;/h:input text&gt; &lt;h: message for=&rdquo;sid&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. sname}&rdquo;/&gt; &lt;h:input text id=&rdquo;sname&rdquo; value=&rdquo;#{student Bean.name}&rdquo; required=&rdquo;true &rdquo; required message= &ldquo;student name is required&rdquo;&gt; &lt;/h:input text&gt; &lt;h: message for=&rdquo;s name&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. saddr}&rdquo;/&gt; &lt;h:input text id=&rdquo;saddr&rdquo; value=&rdquo;#{student Bean. saddr }&rdquo; required=&rdquo;true &rdquo; required message= &ldquo;student address is required&rdquo;&gt; &lt;h: message for=&rdquo;saddr&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. semail}&rdquo;/&gt; &lt;h:input text id=&rdquo;semail&rdquo; value=&rdquo;#{student Bean. semail }&rdquo; required=&rdquo;true &rdquo; required message= &ldquo;student email is required&rdquo;&gt; &lt;/h:input text&gt; &lt;h: message for=&rdquo;semail&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. smobile}&rdquo;/&gt; &lt;h:input text id=&rdquo;smobile&rdquo; value=&rdquo;#{student Bean. smobile}&rdquo; required=&rdquo;true &rdquo; required message= &ldquo;student mobile is required&rdquo;&gt; &lt;f:validate range xpattern=&rdquo;/d{2}-/d{10}$&rdquo;/&gt; &lt;/h:input text&gt; &lt;h: message for=&rdquo;smobile&rdquo;/&gt; &lt;h: command button value=&rdquo;#{msg. button}&rdquo;action=&rdquo;#{student bean. add }&rdquo;/&gt; &lt;/h:parel Grid&gt; &lt;/h:from&gt; &lt;/f:view&gt; &lt;/ body &gt; &lt;/html&gt; &nbsp; <strong>Success.JSP</strong> &lt;%@Loglib prefix=&rdquo;f&rdquo; prefix=&rdquo;h&rdquo; &lt;html&gt; &lt;/body &gt; &lt;/f:view&gt;&lt;h1 &gt;student registration success&lt;/h1 &gt;&lt;/fiview &gt; &lt;/body &gt; &lt;/html&gt; &lt;body &gt; &lt;f:view&gt; &lt;h1&gt;Registration success&lt;/h1&gt; &lt;/f:view&gt; &lt;/body &gt; &lt;/html&gt; &nbsp; <strong>Registration bean.java</strong> Package com. durga soft Public class Regiatration bean{ Private strin eid; Private strin ename; Private strin eaddre; Private strin eemail; Private strin emobile; //provide setter()&amp;getter() Public string registration(){ Return &rdquo;success&rdquo;; } &nbsp; <strong>Email validator.java</strong> Package com. soft; Import java. Util. iterator; Import java. Util. resource bundle; Import java. Faces. application. application; Import java. Faces. application. application message; Import java. Faces. component. UI Component; Import java. Faces. content. faces context; Import java. Faces. validator. validator; Import java. Faces. validator. Validator exception; Public class email validate implements validate{ Public void validator(faces context)fe, UI Component we, object value)throws &nbsp;validator exception{ String email=(string)value; If(email. contains(&ldquo;@&rdquo;)){ Application application=fe.get application(); String prp-file=application .get message bundle(); Resource bundle bundle=resource bundle. get bundle(pre-file)<strong>;</strong> String err-msg=bundle. Get string(&ldquo;email- validator&rdquo;); Faces message fm= new faces message(); Fm.set detail(err-msg); Throw new validator exception(fm); } } } &nbsp; <strong>Faces-config.xml</strong> &lt;Faces-config&gt; ----- ----XSD &lt;managed. bean&gt; &lt;managed. Bean-name&gt;studentBean&lt;/managed. Bean-name&gt; &lt;managed. Bean-class&gt;com. soft. registration bean &lt;managed. Bean-scope&gt;session&lt;/&nbsp;&nbsp;&nbsp;&nbsp; &gt; &lt;/managed. Bean&gt; &lt;navigation-rule&gt; &lt;from-view- id&gt;/employee from.jsp&lt;/&gt; &lt;navigation-case&gt; &lt;from-outcome &gt;success &lt;/ &gt; &lt;to-view-id&gt;/success.jsp&lt;/ &gt; &lt;/navigation-rule&gt; &lt;validator&gt; &lt; validator -id&gt;email-validator&lt;/&nbsp; &gt; &lt;validator-class&gt;com.soft.SIDValidator&lt;/&gt; &lt;/validator&gt; &lt;application&gt; &lt;resource-bundle&gt; &lt;base-name&gt;abc&lt;/b&gt; &lt;var&gt;msg&lt;var&gt; &lt;/resource-bundle&gt; &lt;message-bundle&gt;abc&lt;/ message-bundle&gt; &lt;/application&gt; &lt;/faces-config&gt; &nbsp; &nbsp;</p>43:T2a55,<p>In&nbsp; general, in JSF based web applications, it we submit a form data to server then container will take from data request parameters data and store in request object, where faces context will take from data from request object and store in component tree as part at &ldquo;Apply request values&rdquo; life cycle phase. After getting form data in component tree, faces servlet will store form data from component tree to model object as part of &ldquo;update model&rdquo; life cycle phase after getting data in managed bean object, we will use form data in application logic as part of &ldquo;Invoke application&rdquo; life cycle phase.</p>
<ul>
<li>In the above context, it the form data provided by user is proper then we will not get any exception while executing application, it the form data provided by user is improper then our application may not be executed and there may be a chance to get exceptions.</li>
<li>To over come the above problem, we have to check weather data is valid or not before using data in application logic</li>
<li>To check data validity before using data in application logic, we have to go for &rdquo;data validations&rdquo;</li>
<li>In web applications, there are two places to check data validations</li>
</ul>
<ol>
<li>At client side</li>
<li>At server side</li>
</ol>
<h2>&nbsp;</h2>
<h2>Client side data validations</h2>
<p>If we check data validity just before submitting form to server then it is called as client side data validations.</p>
<ul>
<li>To perform client side data validations, we have to execute &rdquo;java script&rdquo; functions either directly are indirectly at client browser.</li>
</ul>
<ol>
<li>Client side data validations are not suggestible in web application, because, then data validations &rdquo;java.script&rdquo; function at client browser then data validations will not be executed.</li>
<li>At client side data validations, data will be interpreted at the same client machine, so that, client side data validations will provide less security for the data</li>
</ol>
<p>To overcome the above problems, we have to go for server side data validations &nbsp;</p>
<ol start="2">
<li>
<h2><strong>Server side data validations</strong></h2>
</li>
</ol>
<p>It we check data validity after strong data in component tree and just before passing data to managed bean object then it is called as server side data validations.</p>
<ul>
<li>To perform data validations at server side, we will use java code directly it is not required to use java script fun</li>
<li>To perform server side data validations,JSF-1.2 Version has provided the following two types of data validations</li>
</ul>
<ol>
<li>Standard validations</li>
<li>Custom validations</li>
</ol>
<p>&nbsp;</p>
<ol>
<li><strong>Standard validations</strong></li>
</ol>
<p>Standard data validations are the data validations provided by ISF frame work predefinetly</p>
<ul>
<li>2 Version has provided the following for types at data validations</li>
</ul>
<ol>
<li>Required</li>
<li>Length validations</li>
<li>Long range validations</li>
<li>Double Range validations</li>
</ol>
<p>&nbsp; <strong>Required</strong> It is an attribute at each and every input component to check weather data is available or not</p>
<ul>
<li>It data is not available then this attribute will display validation message</li>
</ul>
<p>&nbsp; <strong>NOTE</strong> In JSF all the predefined Validator are having their own predefined message provided by JSF at the following location Extract JSF-api.jar&agrave;Javax&agrave;faces&agrave;message.properties</p>
<ul>
<li>For the required validation JSF has provided predefined validation message in the form of the following key-value pair at message properties file in &lsquo;component errors&rsquo;.</li>
</ul>
<p>Javax. faces. component. UI Input. Required ={o}; validations &nbsp; <strong>Error&nbsp;</strong> value is required</p>
<ul>
<li>To display validation messages in the web page we have to use the following tags.</li>
</ul>
<ol>
<li>&lt;h:message&gt;</li>
<li>&lt;h:message&gt;</li>
</ol>
<p>Where&lt;h:message&gt; is used to display a validation message with respect to a particular field &lt;h:message for=&rdquo;component Id value&rdquo;/&gt; <strong>Eg&nbsp;</strong>&nbsp;&lt;h:message for=&rdquo;uname&rdquo;/&gt; Where&lt;h:message&gt;tag can be used to display all the validations messages of the respective fields which are available in the current page. <strong>e.g&nbsp;</strong>&nbsp;&lt;h:output text value=&rdquo;user name&rdquo;/&gt; &lt;h:input text id=&rdquo;u name &rdquo;value=&rdquo;reg bean. U name&rdquo; required=&rdquo;true&rdquo;/&gt; &lt;h:message for=&rdquo;u name&rdquo;/&gt; &nbsp; <strong>Validate Length</strong></p>
<ul>
<li>It is applied on string data to check the length of the string data eg:&lt;f:validate length minimum=&rdquo;-&rdquo;maximum=&rdquo;--&rdquo;/&gt;</li>
</ul>
<p>Where minimum attribute will take min length value and maximum attribute will take max length value</p>
<ul>
<li>It the provided string data length is less than the specified minimum length value then this Validator will display the following validation message</li>
</ul>
<p>Javax. faces. Validator, length Validator, minimum={1}:validation error value is less than allowable minimum of&rdquo;{0}&rdquo;</p>
<ul>
<li>It we provided string data length is greater than specified maximum length value than this validate will display the following validation message.</li>
</ul>
<p>Javax. faces. Validator. Length Validator. maximum=&rdquo;{1}&rdquo;: validation error. Value is greater than allowable maximum of &ldquo;{0}&rdquo; where{1}will take component name like uname upwd where{0} will take attribute values like &rdquo;minimum&rdquo; and &ldquo;maximum&rdquo; on the basis of the validation msg &nbsp; <strong>&nbsp;</strong> <strong>Eg</strong> &lt;h:output te:1 value=&rdquo;password&rdquo;/&gt; &lt;h:input text id=&rdquo;upwd&rdquo; value=#{reg bean. upwd}/required=&rdquo;true&rdquo;&gt; &lt;f:validate length minimum=&rdquo;6&rdquo;maximum=&rdquo;15&rdquo;/&gt; &lt;/h:input text&gt; &lt;h:message for=&rdquo;upwd&rdquo;/&gt; &nbsp; <strong>validate long range</strong> This Validator can be used to check wheat here the data or on input field is long data or not and the value is available in the specified range or not. <strong>Case1 &nbsp;</strong>If the provide value is not long data type then this Validator will display the following validation message javax. faces. Validator. lang range Validator. Type={0}; validation error: value is not at correct type <strong>Case2 &nbsp;</strong>If the provide value is not long data, it we provides only &ldquo;minimum&rdquo; attribute without &ldquo;maximum&rdquo; attribute and it the provided value in the input field is less than the specified &ldquo;minimum&rdquo; attribute value then this Validator will display the following validation message Javax. faces. Validator. Lang range Validator. Minimum= {1}: validation error: value is greater than allowable minimum of&rdquo;{0}&rdquo; <strong>Case3 &nbsp;</strong>It the provided data is long data, it we provide only &rdquo;maximum&rdquo; attribute in&lt;f:validate long range&gt; Validator and if the provided value in input field is greater than &rsquo;maximum&rsquo; attribute then this Validator will display the following validation message. Javax. faces. validate. Lang range Validator. Maximum={1}; validation error: value is greater than allowable maximum of &ldquo;{0}&rdquo; <strong>Case4&nbsp;</strong>&nbsp;It the provided value is lang data, it we provided both &ldquo;minimum&rdquo; and &ldquo;maximum&rdquo; attribute in &lt;f:validate lang range&gt;valid after and if the provided value in put field is less than the provided &ldquo;minimum&rdquo; attribute value are greater than the &ldquo;maximum&rdquo; attribute value then this Validator will display the following message. Javax.faces. validatore. Long range validatore. Not- in- range ={2}; validation error: specified attribute is not bet n the expected values of {0} and{1} <strong>Eg</strong>&nbsp;&lt;h:output text value=&rdquo;user age&rdquo;/&gt; &lt;h:input text id=&rdquo;age&rdquo; value=&rdquo;#{reg bean. uage}&rdquo; required=&rdquo;true&rdquo;&gt; &lt;f:validate lang range minimum=&rdquo;18&rdquo;maximum=&rdquo;30&rdquo;&gt; &lt;/h: input text &gt; &lt;h: message for=&rdquo;uage&rdquo; &gt; &nbsp; <strong>&nbsp;Validate double range</strong> This Validator can be used to check whether the data on an input field is double or not and the provided value is a variables within the specified range or not &lt;f:validate double range minimum=&rdquo;--&rdquo;maximum=&rdquo;--&rdquo;&gt; Where &rdquo;minimum&rdquo; and &rdquo;maximum&rdquo; attributes can be used to provided minimum and maximum values. <strong>Case1&nbsp;</strong>If the provided data on the respective&nbsp; field is not double data then this Validator will display the following error msg. Javax. faces. Validator. double range Validator. type={0}:validation error: value is not of the correct type. <strong>Case2&nbsp;</strong>It the provided data is double data, It we provide only &rdquo;minimum&rdquo; attribute without &ldquo;maximum&rdquo; attribute In&lt;f:validator double range&gt;Validator and it the provided value is less than the specified minimum value then this validator will display the following validation msg Javax.faces. validator, double range Validator MINIMUM{1}:validation error:value is less then allowable minimum of &ldquo;{0}&rdquo;<strong>&nbsp;</strong> <strong>Case3&nbsp;</strong>It the provided data is double data, It we provide only&nbsp;&nbsp;&nbsp; &nbsp;&rdquo; maximum&rdquo; attribute without &ldquo;minimum &rdquo; attribute In&lt;f:validator double range&gt;Validator and it the provided value is greater than the specified maxim value then this validator will display this validation msg Javax. faces. Validator, double range Validator maximum{1}:validation error: value is greater than allowable maximum of &ldquo;{1}&rdquo;validation error: value is greater than allowable maximum of &ldquo;{1}&rdquo; <strong>Case4&nbsp;</strong>It we provided data is double data, It we provide both attributes In&lt;f:validator double range&gt;validator and it the provided value is less than the specified min value or greater than validation msg. Javax. faces. validatore, double range validator&nbsp; NOT-IN RANGE {2}:validation error: Specified attribute is not bet n the expected values of{0}&amp;{1} &nbsp; <strong>Eg</strong>&nbsp;&lt;h:output text value=&rdquo;user salary&rdquo;/&gt; &lt;h:input text id=&rdquo;usal&rdquo; value=#{reg Bean. usal}&rdquo;required=&rdquo;true&gt; &lt;f:validator double range minimum=&rdquo;2500&rdquo;maximum=&rdquo;50000&rdquo;/&gt; &lt;/h:input text&gt; &lt;h:message fore=&rdquo;usal&rdquo;/&gt; &nbsp;</p>44:T5ed,<p><strong>steps to provide I18N Support in JSF Application</strong> &nbsp;</p>
<ul>
<li><strong>Prepare properties files for each and every locale</strong></li>
</ul>
<p>To prepare properties files, we have to use the following naming convections for the properties file &lt;base-name&gt;-&lt;long&gt;.properties In the properties files, we have to provide locale respective messages in the form of key-value pairs, where keys should be in English and values should be in locale language <strong>EX:</strong> abe-en. properties:- Income = user name Upwd= password &nbsp; <strong>abc-it. properties</strong> u name- user name Upwd= password</p>
<ul>
<li><strong>Configure locale and properties file in faces configuration file</strong></li>
</ul>
<p>To configure locale and properties files in faces configuration file, we have to use the following tags &lt;faces-config&gt; --- &lt;application&gt; &lt;locale-config&gt; &lt;default-locale&gt;en&lt;/default-locale&gt; &lt;supported-locale&gt;it&lt;/ supported -locale&gt; &lt;/locale-config&gt; &lt;resource-bundle&gt; &lt;base-name&gt;abe&lt;/base-name&gt; &lt;var&gt;msg&lt;/ var &gt; &lt;/resource-bundle&gt; &lt;/application&gt; ---------- &lt;/faces-config&gt;</p>
<ol>
<li><strong>Access the message from properties file</strong></li>
</ol>
<p>To access the messages from properties file, we have to use the following &lt;hi output text&gt;gag &lt;h:output text value=&rdquo;#{msg. uname}&rdquo;/&gt; &lt;h:output text value=&rdquo;#{msg. upwd}&rdquo;/&gt;</p>45:T3305,<p><img class="alignnone size-medium wp-image-10027" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_17-460x417.png" alt="Screenshot_17" width="300" height="271" /> &nbsp;&nbsp;</p>
<p>Abc-en-us.properties:</p>
<pre class="language-markup"><code>welcome.message=Welcome to the English US version.
</code></pre>
<p>Abc-it-IT.properties:</p>
<pre class="language-markup"><code>welcome.message=Benvenuti alla versione italiana.
</code></pre>
<div class="bg-black mb-4 rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans">
<p>Abc-it-IN.properties:</p>
<pre class="language-markup"><code>welcome.message=Benvenuti alla versione indiana.
</code></pre>
<div class="bg-black mb-4 rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans">
<p>FORM.HTML:</p>
<pre class="language-markup"><code>&lt;html&gt;
  &lt;body&gt;
    &lt;form method="post" action="/i18n"&gt;
      &lt;table&gt;
        &lt;tr&gt;
          &lt;td&gt;Select language:&lt;/td&gt;
          &lt;td&gt;Select country:&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;select name="language"&gt;
              &lt;option value="en"&gt;English&lt;/option&gt;
              &lt;option value="it"&gt;Italian&lt;/option&gt;
              &lt;option value="hi"&gt;Hindi&lt;/option&gt;
            &lt;/select&gt;
          &lt;/td&gt;
          &lt;td&gt;
            &lt;select name="country"&gt;
              &lt;option value="us"&gt;United States&lt;/option&gt;
              &lt;option value="it"&gt;Italy&lt;/option&gt;
              &lt;option value="in"&gt;India&lt;/option&gt;
            &lt;/select&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;
            &lt;input type="submit" value="Submit"&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
<div class="bg-black mb-4 rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans">
<p>I18NServlet.java:</p>
<div class="bg-black mb-4 rounded-md">
<div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans">
<pre class="language-markup"><code>package com.soft;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/i18n")
public class I18NServlet extends HttpServlet {

  private static final String BUNDLE_NAME = "Abc";
  private static final String WELCOME_MESSAGE_KEY = "welcome.message";
  private static final String HTML_START = "&lt;html&gt;&lt;body&gt;&lt;h1&gt;";
  private static final String HTML_END = "&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";

  @Override
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
      String language = request.getParameter("language");
      String country = request.getParameter("country");
      Locale locale = new Locale(language, country);

      NumberFormat numberFormat = NumberFormat.getInstance(locale);
      DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
      ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, locale);

      String welcomeMessage = bundle.getString(WELCOME_MESSAGE_KEY);

      PrintWriter out = response.getWriter();
      out.println(HTML_START);
      out.println("Number: " + numberFormat.format(1345.2345) + "&lt;br&gt;");
      out.println("Date: " + dateFormat.format(new Date()) + "&lt;br&gt;");
      out.println("Message: " + welcomeMessage);
      out.println(HTML_END);
    } catch (Exception e) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid request");
    }
  }
}
</code></pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<ul>
<li>If we use the above approach to provid II8N Support then every time user has to specify lang country, it is not suggestible in web applications.</li>
<li>To overcome the above problems, we have to provide I18N Support with out depending on the user, by getting client browser provided language setup</li>
<li>When we submit a request from a client browser then browser provided lang will be send to server in the from at &ldquo;accept lang&rdquo; request header, here it we get &ldquo;accept-language&rdquo; request header value then it is possible to identify from which local the request is coming, with this, we are able to provide I18N Support without specifying lang &amp; country by the user</li>
<li>To get a particular request header value, we have to use the following method from servlet request, public string get header (String header-name)</li>
<li>Public class I18N Servlet extends Http servlet{ = IL; Protected void do Get(Http Servlet Request request, Http Servlef Response response) Throws servlet Exception, Ioexception{</li>
</ul>
<p>Try{ String locate=request. get header(&ldquo;accept-language&rdquo;);</p>
<p>String Tokenizer st= new string tokenizer(local, &ldquo;-&rdquo;);</p>
<p>Int count= st. count tokens();</p>
<p>Local i=null;</p>
<p>If (count==1){ String long=st.next token();</p>
<p>I=new locale (c lang);</p>
<p>{ If(count==2){ String lang=st. next token();</p>
<p>String country=st. next token();</p>
<p>I=new locale (c lang, country); }</p>
<p>If(count==3){ String lang=st. next token();</p>
<p>String country=st.</p>
<p>next token();</p>
<p>String sys-var=st.</p>
<p>next token();</p>
<p>I=new locale (lang, country), sys-var); }</p>
<p>Number Format</p>
<p>nt=number formal,</p>
<p>get Insurance(l);</p>
<p>&nbsp; <img class="alignnone wp-image-10030" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2015/01/Screenshot_18-460x435.png" alt="Screenshot_18" width="412" height="389" /> &nbsp;</p>
<p><strong>Abc-en. properties</strong></p>
<pre class="language-markup"><code># English language properties file
# Header
Header1 = Durga Software Solutions
Header2 = Registration Form

# Form fields
Sid = Student ID
Sname = Student Name
Semail = Email ID
Smobile = Contact No.

# Button
Button = Register

# Success and failure messages
Success = Student registration successful
Failure = Student registration failed
</code></pre>
<p>&nbsp;<strong>Abc-it. Properties</strong></p>
<p>Header1=Durga software solutions Header2=Registration Form Sid=student Id Sname=student Name Semail=email id Smobile=contact no Button=registration Success=student registration success Failure=student registration failure &nbsp;</p>
<p><strong>Abc-te. Properties</strong></p>
<pre class="language-markup"><code>Header1=software solutions
Header2=Darakstu patram
Sid=vidyardu Gurdimpu snkya
Sname=vidyardi peru
Semail=vidyuth samachara Gurthimlu
Smobile=sampradimpu sankya
Button=Darakasthu
Success=Vidyardi Darakastu safalamayinadhi
Failure=Vidyardi Darakastu cifalamayinadhi
</code></pre>
<p><strong>Index.html</strong>&nbsp;</p>
<pre class="language-markup"><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv="Refresh" content="2;URL=http://localhost:1010/I18napp/registrationform.dss"&gt;
        &lt;title&gt;Insert title here&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt;Application is loading&hellip;&lt;/h1&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p><strong>Registrationform.JSP</strong></p>
<p>&nbsp;&nbsp;</p>
<pre class="language-markup"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %&gt;
&lt;%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %&gt;
&lt;%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
    &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;f:view&gt;
      &lt;h:form&gt;
        &lt;h:panelGrid columns="2"&gt;
          &lt;h:outputText value="#{msg.sid}" /&gt;
          &lt;h:inputText id="sid" value="#{regBean.sid}" /&gt;
          &lt;h:outputText value="#{msg.sname}" /&gt;
          &lt;h:inputText id="sname" value="#{regBean.sname}" /&gt;
          &lt;h:outputText value="#{msg.semail}" /&gt;
          &lt;h:inputText id="semail" value="#{regBean.semail}" /&gt;
          &lt;h:outputText value="#{msg.smobile}" /&gt;
          &lt;h:inputText id="smobile" value="#{regBean.smobile}" /&gt;
          &lt;h:commandButton value="#{msg.button}" action="#{regBean.registration}" /&gt;
        &lt;/h:panelGrid&gt;
      &lt;/h:form&gt;
    &lt;/f:view&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p><strong>Success. Jsp</strong></p>
<pre class="language-markup"><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %&gt;
&lt;%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
   &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;
      &lt;f:view&gt;
         &lt;h1&gt;&lt;h:outputText value="#{msg.success}" /&gt;&lt;/h1&gt;
      &lt;/f:view&gt;
   &lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p><strong>Failure.jsp</strong></p>
<pre class="language-markup"><code>&lt;%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
    &lt;title&gt;Failure Page&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;f:view&gt;
        &lt;h1&gt;&lt;h:outputText value="#{msg.failure}" /&gt;&lt;/h1&gt;
    &lt;/f:view&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
<p><strong>Registration Bean.java</strong></p>
<pre class="language-markup"><code>package com.soft;

import java.util.Locale;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;

public class RegistrationBean {
    private String sid;
    private String sname;
    private String semail;
    private String smobile;

    // getters and setters

    public String registration() {
        String status = "";
        if (sid.startsWith("DSS-")) {
            status = "success";
        } else {
            status = "failure";
        }
        return status;
    }

    public String getRegistrationForm() {
        return "Registration form";
    }
}
</code></pre>
<p><strong>Faces-config.xml</strong></p>
<pre class="language-markup"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;Faces-config xmlns="http://Java.sun.com/xml/ns/java" version="1.2"&gt;
    &lt;managed-bean&gt;
        &lt;managed-bean-name&gt;regBean&lt;/managed-bean-name&gt;
        &lt;managed-bean-class&gt;com.DurgaSoft.RegistrationBean&lt;/managed-bean-class&gt;
        &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
    &lt;/managed-bean&gt;
    &lt;navigation-rule&gt;
        &lt;from-view-id&gt;/registrationform.jsp&lt;/from-view-id&gt;
        &lt;navigation-case&gt;
            &lt;from-outcome&gt;success&lt;/from-outcome&gt;
            &lt;to-view-id&gt;/success.jsp&lt;/to-view-id&gt;
        &lt;/navigation-case&gt;
        &lt;navigation-case&gt;
            &lt;from-outcome&gt;failure&lt;/from-outcome&gt;
            &lt;to-view-id&gt;/failure.jsp&lt;/to-view-id&gt;
        &lt;/navigation-case&gt;
    &lt;/navigation-rule&gt;
    &lt;navigation-rule&gt;
        &lt;from-view-id&gt;/menu.jsp&lt;/from-view-id&gt;
        &lt;navigation-case&gt;
            &lt;from-outcome&gt;registration form&lt;/from-outcome&gt;
            &lt;to-view-id&gt;/registrationform.jsp&lt;/to-view-id&gt;
        &lt;/navigation-case&gt;
    &lt;/navigation-rule&gt;
    &lt;application&gt;
        &lt;locale-config&gt;
            &lt;default-locale&gt;en&lt;/default-locale&gt;
            &lt;supported-locale&gt;it&lt;/supported-locale&gt;
            &lt;supported-locale&gt;te&lt;/supported-locale&gt;
        &lt;/locale-config&gt;
        &lt;resource-bundle&gt;
            &lt;base-name&gt;abc&lt;/base-name&gt;
            &lt;var&gt;msg&lt;/var&gt;
        &lt;/resource-bundle&gt;
    &lt;/application&gt;
&lt;/Faces-config&gt;
</code></pre>
<p><strong>Web.xml</strong></p>
<p>Same as prev. applications. <strong>&nbsp;</strong> &nbsp; &nbsp;</p>46:Tf54,<p>In java applications, we are able to provide I18N Supported in the form of the following 3 areas.</p>
<ol>
<li>Number formations</li>
<li>Date formations</li>
<li>Message formations</li>
</ol>
<p>&nbsp; 1<strong>.Number formations</strong></p>
<ul>
<li>To represent a number w.r.to a particular local we have to use a predefined class java. Text. Number format</li>
<li>To use number format class in java applications. We have to use the following steps</li>
</ul>
<ol>
<li><strong>Prepare number format class object</strong></li>
</ol>
<p>To prepare number format class object, we have to use the following static factory method public static number format get instance(Local l)<strong>&nbsp;</strong> <strong>&nbsp;</strong> <strong>2.Format a number w.r.to a local</strong> To &nbsp;format number, we have to use the following method public string format(XXX NUMBER)Where xxx may be byte, short, int, float,&hellip; Import java. Text*; Import java. util*; Public class Test { Public static void main(strin[]args) throws exception { Local l=new local(&ldquo;it&rdquo;,&rdquo;It&rdquo;); Number format nf=number format. Get instance(l); s.o.p(nf.format(12345.234567)); } } &nbsp;</p>
<ol start="2">
<li><strong>Date formations</strong></li>
</ol>
<p>If we want to represent date w.r.to a particular local. We have to use a predefined class java.text. date formal</p>
<ul>
<li>It we want to use data format in java applications we have to use the following steps</li>
</ul>
<ol>
<li><strong>prepare local object -</strong></li>
</ol>
<p>Local i= new locale(&ldquo;en&rdquo;,&rdquo;us&rdquo;);</p>
<ol start="2">
<li><strong>Create data format object&nbsp;</strong></li>
</ol>
<p>To create data format object, we have to use the following static factory method. Public static data format get data insurance (int data- sty, local i)</p>
<ol start="3">
<li><strong>Format data w.r.t the specified local</strong></li>
</ol>
<p>To represent data. W.r.t the specified local, public string format(date d) &agrave;Import java. text.*; Import java. util.*; Public class test { p.s.v.m() throws exception { Locale l=new locale(&ldquo;It&rdquo;,&rdquo;IT&rdquo;); Data format dt= Date format. Get date insurance.col); s.o.p(dt. format; new date()))); } }</p>
<ol start="4">
<li><strong>Message formations</strong></li>
</ol>
<p>To represent a message w.r.to a particular local we have to use a predefined class provided by java java. util. Resource bundle It we want to use resource bundle in java application &nbsp;we have to use the following steps</p>
<ul>
<li><strong>Prepare properties files with the local messages</strong></li>
</ul>
<p>To prepare properties files we have to take a text file and provide locale messages in the from of key- value pairs and we must save properties file with the following naming conversion &lt;base-name&gt;-&lt;long&gt;-&lt;country&gt;&lt;sys-var&gt;. prepare files <strong>Abc-en-us. Properties</strong> Uname= user name Upwd= password</p>
<ul>
<li><strong>prepare locale object</strong></li>
</ul>
<p>Local I = new locale(&ldquo;en&rdquo;,&rdquo;us&rdquo;); &nbsp;</p>
<ul>
<li><strong>prepare resource bundle object</strong></li>
</ul>
<p>To prepare resource bundle class object we have to&nbsp; use the following static factory method public static resource bundle[string base &ndash; name locale()</p>
<ul>
<li><strong>Get message from resource bundle object on basis of key</strong></li>
</ul>
<p>To get a message on the basis of a key, we have to use the following method public string get string(string key) <strong>Abc-en-us. Properties</strong> Welcome=welcome to en us users <strong>Abc &ndash;it IT Properties</strong> Welcome=welcome to it It USERS. Public class test { p.S.V.M()THROWS Exception { Locate I = new locale(&ldquo;it&rdquo;,&rdquo;IT&rdquo;); Resource bundle rb = resourceBundle. GetBundle(&ldquo;abc&rdquo;,i); s.o.p(rb. get string(&ldquo;welcome&rdquo;)); } }</p>47:T283e,<p><strong>Steps to use Hyperlinks in JSF pages</strong> <strong>Step1: </strong>Prepare hyperlink in JSP or xhtml pages depending on the JSF Version To prepare hyperlink we have to use the following html &lt;h:command link value=&rdquo;--&rdquo;action=&rdquo;--&rdquo;/&gt; &agrave;Where &rdquo;values&rdquo; attribute will be hyperlink label &agrave;Where &rdquo;action&rdquo; attribute will take JSF expression to refer a managed bean method to execute. <strong>Eg -</strong> &lt;h:command link value=&rdquo;login&rdquo; action=#{log in bean get log in page}&rdquo;/} &nbsp; <strong>NOTE</strong> &lt;h:command link&gt;must be used under&lt;h:form&gt; <strong>Step2&nbsp;-&nbsp;</strong>&nbsp;To prepare action method in managed bean component Prepare a method in managed bean component with string return type and its name must be same as the method name which we specified in action attribute expression in &lt;h:command link&gt;tag Public class log in bean{ Public string get log in page(){ Return &rdquo;log in form&rdquo;; } }<strong>&nbsp;</strong> <strong>&nbsp;</strong> <strong>Note -</strong> In case of JSF 2.X The return value from action method should be same as the target age name which we want to open in case of annotations. <strong>Step3&nbsp;</strong>&nbsp;PREPARE NAVIGATION RULE IN FACES &ndash;CONFIGE.XML FILE &lt;Faces-config&hellip;}xsd &lt;navigation- rule&gt; &lt;from- view-id&gt;1page where clicked on hyperlink&lt;/from &ndash; view -d&gt; &lt;navigation- case&gt; &lt;navigation- rule&gt; &lt;/faces-config&gt; <strong>Note</strong> In JSF 2.X,IF we use annotations than this step is not required &nbsp; &nbsp; <img class="alignnone size-full wp-image-9996" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_1612.png" alt="Screenshot_16" width="457" height="898" /> &nbsp; &nbsp; <strong>Login from.jsp </strong> &lt;%@tag lib prefix=&rdquo;f&rdquo;url=&rdquo;http://java.sun.com/jsf/core&rdquo;%&gt; &lt;%@taglib prefix=&rdquo;h&rdquo;url=&rdquo;http://java.sun.com/jsf/html&rdquo;%&gt; &lt;html&gt; &lt;body&gt; &lt;f:view&gt; &lt;font color=&rdquo;red&rdquo;&gt; &lt;h1&gt; software solutions&lt;/h1&gt; &lt;/h2;Log in page&lt;/h2&gt; &lt;/font&gt; &lt;h:form&gt; &lt;h:panel Grid column=&rdquo;2&rdquo;&gt; &lt;h:ourput text value=&rdquo;user name&rdquo;/&gt; &lt;h:in put text id=u name value=&rdquo;#{log in bean. U name}&rdquo;/&gt; &lt;h:ourput text value=&rdquo;password&rdquo;/&gt; &lt;h:in put text id=u pwd value=&rdquo;#{log in bean. U pwd}&rdquo;/&gt; &lt;h: command button value=&rdquo;log in&rdquo; action=&rdquo;#{log in bean. Log in&rdquo;/&gt; &lt;h3&gt;&lt;h: command link value=&rdquo;registration&rdquo; Action =&rdquo;#{ log in bean .get registration page}&rdquo;/&gt;&lt;/h3&gt; &lt;/h:parel Grid&gt; &lt;/h: form&gt;&lt;/f:view&gt;&lt;/body&gt;&lt;/html&gt; &nbsp; <strong>Registration form. JSP -</strong> &lt;%@taglib prefix &ldquo;f&rdquo; &lt;html&gt; &lt;body&gt; &lt;f:view&gt; &lt;font color=&rdquo;red&rdquo;&gt; &lt;h1&gt; soft&lt;/h1&gt; &lt;h2&gt; registration page &lt;/h2&gt; &lt;/font &gt; &lt;h:from&gt; &lt;h:panel Grid column=&rdquo;2&rdquo;&gt; &lt;h:output text value=&rdquo;user name&rdquo;/&gt; &lt;h: input text id =u name value=&rdquo;#{reg bean. u name}&rdquo;/&gt; &lt;h: output text value=&rdquo;pass word&rdquo;/&gt; &lt;h:input text id= u pwd value=&rdquo;#{reg bean, u pewd}&rdquo;/&gt; &lt;h: ouput text value=&rdquo;email&rdquo;/&gt; &lt;h:input text id- u email value=&rdquo;#{reg bean. uemail}&rdquo;/&gt; &lt;h:out put text value=&rdquo;mobile&rdquo;/&gt; &lt;h: input text id= umoble value=&rdquo;#{reg bean. U mobile}&rdquo;/&gt; &lt;h:command button value=&rdquo;Registration&rdquo;action =&rdquo;#{reg bean. registration}&rdquo;/&gt; &lt;/h: panel Grid&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/body&gt; &lt;/html&gt; &nbsp; <strong>Success.jsp -</strong> &lt;%@ tag lib prefix=&rdquo;f&rdquo;--&gt; &lt;html&gt; &lt;body&gt; &lt;f:view&gt; &lt;h:command link value=&rdquo;login&rdquo; action=&rdquo;#{log in bean get log in page}&rdquo;/&gt; &lt;/h:form&gt; &lt;/f:view&gt;&lt;/body&gt;&lt;/html&gt; &nbsp; <strong>Failure.JSP&nbsp;</strong> &lt;%@ taglib prefix=&rdquo;f&rdquo; &lt;html&gt; &lt;body&gt; &lt;f:view&gt; &lt;h1&gt;failure&lt;/h1&gt; &lt;h:form&gt; &lt;h:command like value=&rdquo;registration&rdquo; action=&rdquo;#{log in bean. Get registration page}&rdquo;/&gt; &lt;/h:form&gt; &lt;/f:view&gt; &lt;/body&gt; &lt;/html&gt; &nbsp; <strong>Existed.jsp</strong> &lt;%@taglib prefix=&rdquo;f&rdquo; &lt;html&gt; &lt;body&gt; &lt;/f:view&gt; &lt;h1&gt;User already existed&lt;/h1&gt; &lt;h:from&gt; &lt;h:command link value=&rdquo;log in &rdquo;action=&rdquo;#{log in bean. Get language&rdquo;/&gt; &lt;/h: form&gt;&lt;/f:view&gt;&lt;/body&gt;&lt;/html&gt; &nbsp; <strong>Index. Html</strong> &lt;/html&gt; &lt;head&gt; &lt;meta http-equiv=&rdquo;Refresh Content=&rdquo;2;url=http://local host:1010/log in&nbsp; app/ log in form. dss&gt; &lt;/head&gt; &lt;body&gt;&lt;h1&gt;Application is Loading&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; &nbsp; <strong>Log in Bean. Java</strong> Package com. soft Import javax. faces. bean. Managed bean; Import javax. faces. bean. sessionscoped; @ Managed bean(name=&rdquo;log in Bean&rdquo;) @session scoped Public class log in bean { Private string u name; Private string upwd; //provide getter()&amp; setters() Public string get log in page(){ Return &rdquo;log in form&rdquo;; } Public string get registration page() { Return &rdquo;Registration form&rdquo;; } Public string log in(){ User DAO dao=user dao factory. Get user dao(); String status=dao.check log in ( u name, u pwd); Return status; } } &nbsp; <strong>Registration Bean. Java</strong> Package com. soft; Import javax. faces. bean. managed bean; Import javax. faces. bean. Session scoped; @managed Bean (name=&rdquo;meg Bean&rdquo;) @Session scoped Public class registration bean{ Private string u name; Private string u pwd; Private string uemail; Private string u mobile; //provide getter()&amp; setter() Public string registration() { User DAO dao=user Dao Factory. get user Dao(); String status=dao. registration (u name. upwd, ue mail, umobile); Return status; } } &nbsp; <strong>User Dao.Java</strong> Package com.soft; Public interface user Dao{ Public string check log in(string u name, string u pwd) Public string registration[string u name, String upwd, string uemail, string umobile); } &nbsp; <strong>User Dao Impl.java</strong> Package com. soft Import.java. sql. connection; Import .java. sql. Prepared statement Import .java. sql. ResultSet Public class user dao imp/ implements user dao { String status=&rdquo;&rdquo;; Public storing checkLog in (string uname, string upwd) { Try { Connection con- Connection factory. get Connection(); Prepared statement pst=con.PrepareStatement(&ldquo; Select from reg-users where u name=&rdquo;+u name+&rdquo;and ResultSet ms=pst.executeQuery(); Boolean b= ms.next(); If(b==true) { Status=&rdquo;success&rdquo;; } Else { Status-&ldquo;failure&rdquo;; } } Catch(Exception e) {</p>
<ol>
<li>print stack trace();</li>
</ol>
<p>} Return status } Public string registration(string uname, string upwd, stromg uemail. String u mobile){ Try{ Connection con- Connection factory. get Connection(); Prepared statement pst=con. prepareStatement (&ldquo;select*from reg-users where uname=&rdquo;+u name+&rdquo;) ResultSet ms=pst. execute query(); Boolean b=ms. next(); If(b==true){ Status=&rdquo;existed&rdquo;; } Else{ Pst=con. prepared statement (&ldquo;insert into reg-users values(????)&rdquo;); Pst. string(1,uname); Pst. string(2,upwd); Pst. string(3,uemail); Pst. string(4,umobile); Pst. execute(); Status=&rdquo;success&rdquo;; } } Catch(Exception e){ Status=&rdquo;failure&rdquo;;</p>
<ol>
<li>print stack trace()</li>
</ol>
<p>} Return statue; } } <strong>&nbsp;</strong> <strong>User Dao Factory. Java</strong> Package com. soft; Public class user Dao Factory{ Static user Dao dao; Static{ Dao= new userDaoimpl(); } Public static user Dao get user Dao(){ Return dao; } } &nbsp; <strong>Connection factory. Java</strong> Package com. soft Import Java.Sql.*; Public class Connection factory { Static Connection; Static{ Try{ Class.for Name(&ldquo;oracle jdbc. oracle driver&rdquo;); Con= driver manager. Get Connection(&ldquo;jdbc. Oracle: thin:@local host:1521: &ldquo;scoh&rdquo;,&rdquo;tiger&rdquo;); } Catch (Exception c){</p>
<ol>
<li>print stack trace();</li>
</ol>
<p>} } Public static Connection getConnection(){ Return con; } } &nbsp; <strong>Web.xml</strong> SQN as Designing Java applications w.r.t the users notive Connection&nbsp; is called as II8N</p>
<ul>
<li>Java Technology is able to provide very good support for II8N due to the availability of UNICODE representation</li>
<li>To provide II8N Support in java applications, first , we have to represent all a group of local users</li>
<li>To represent a group local users, first, we have to classify all the users as per the following local parameters</li>
</ul>
<p>&nbsp;</p>
<ol>
<li><strong>Language</strong></li>
</ol>
<p>It will be represented in the form of two lower case letters <strong>Ex:</strong> &rdquo;en&rdquo;,&rdquo; hi&rdquo;,&rdquo; te&rdquo;,&hellip;. &nbsp;</p>
<ol start="2">
<li><strong>Country</strong></li>
</ol>
<p>It will be represented in the form at two upper case letters Ex;&rdquo;us&rdquo;,&rdquo; IN&rdquo;,&rdquo;IT&rdquo;,&hellip;. &nbsp;</p>
<ol start="3">
<li><strong>Operating system[system variant]</strong></li>
</ol>
<p>It will be represented in the form of three lower case letters Ex: &rdquo;win&rdquo;,&rdquo; lin&rdquo;,&rdquo; uni&rdquo;,&hellip;.</p>
<ul>
<li>To represent a group of local users, java tech has provided a predefined class java.util. local</li>
<li>To create locale class object, we have to use the following constructors.</li>
</ul>
<p>Public local(String lang) Public local(String lang, String country) Public local(String lang, String country String sys-var) &nbsp; <strong>Ex</strong> Local I= New local(&ldquo;en&rdquo;); Local I= New local(&ldquo;en&rdquo;,&rdquo; us&rdquo;); Local I= New local(&ldquo;en&rdquo;,&rdquo;s&rdquo;,&rdquo;wub&rdquo;); &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>48:T133e,<p>There are 2 types of enterprise application</p>
<ol>
<li>Web application</li>
<li>Distributed applications</li>
</ol>
<p>&nbsp; &nbsp; <strong>1) What are the differences between web applications and distributed applications?</strong> <strong>A:</strong> Web applications are the server side applications, which will be designed without distributing application logic over more than one JVM</p>
<ul>
<li>Distributed applications are the java applications, which will be designed by distributing application logic over more than one JVM</li>
</ul>
<p>&nbsp; <strong>2)</strong> &nbsp;Web applications will be designed by using web technologies like CGI, Servlet , JSPS Distributed applications will be designed by using the technologies like socket programming, RMI,EJBS, CORBA, Web services. <strong>3)</strong> In case of web application, no separate java program for client in case of distributed application, there is a separate java program fore client and fore server. 4) web application is a collection of web components like servlet, JSPS,--- which will be executed by using only web containers. Distributed application is a collection of distributed components like EJBS, Which will be executed by using EJB Container. 5) Web applications will be executed by both web servers and application servers. Distributed applications will be executed by only application servers. 6) Web applications will provide services for only web client is browser Distributed application will provide services for only type of client. &nbsp; <strong>Note</strong> In case of distributed applications, client may be any thing like a java program with main() method. An applet, a servlet, a JSP page, frame work specific components like action classes in struts and managed beans in JSF, 7) The main purpose at web application initially to general static response from server and distributed applications is to generate dynamic response.</p>
<ul>
<li>At present the intention of web application to generate dynamic response from server machine and distributed application is to establish connection abut n local machine and remote machine in order to get remote services from remote machine</li>
</ul>
<p>8) It we want to use more web application and distributed application with in a single enterprise application then we will use web application to&nbsp; implement presentation&nbsp; and part we will use distributed application to implement business logic. &nbsp; <strong>Web application development models</strong> To design web application in a standard pattern, we have to use the following models. 1.Model- I Arch 2.Model- I Arch &nbsp; <strong>1.Model- I Arch</strong> In this arch, a JSP page is a configure as controller, it will take responsibility to pick up requests clients and to control the entire web application</p>
<ul>
<li>In model- I Arch, a java bean component will be used as model part to execute application business logic</li>
<li>Model-I arch, is also called &ldquo;JSP Front&rdquo;, because a single JSP page is acting as front controller to requests and to control web application.</li>
<li>Model &ndash;I Arch, is also called as page centric arch, because a single JSP page is controlling the entire web application</li>
</ul>
<p>&nbsp; &nbsp; <img class="alignnone wp-image-9966" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_548-460x176.png" alt="Screenshot_5" width="555" height="211" /> &nbsp; &nbsp; &nbsp;</p>
<ul>
<li>In model-I Arch a single JSP page is acting as controller, to control the entire web application the existed JSP features will not be sufficient it required to code in JSP pages, providing java code inside JSP page is not suggestible</li>
<li>In model-I arch, there is no separation bet n presentation logic and controller logic, it may provide tightly coupled design for the web application.</li>
<li>To over come all the problems we have to go for model II Architecture.</li>
</ul>
<p>&nbsp; <strong>Model &ndash;IT Arch</strong></p>
<ul>
<li>In model s arch. We will use a servlet as controller and a set of JSP pages as view parted</li>
<li>Model ii arch. Is also called as &ldquo;Servlet front&rdquo; because a single servlet is taking responsibilities to pick up all the request from client.</li>
<li>Model IT Arch is also called as &ldquo;Servlet control &rdquo;arch because a single servlet is controlling the complete web application.</li>
<li>Model &ndash;II arch is purely an implementation of MVC design pattern</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-9967" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_639-460x157.png" alt="Screenshot_6" width="529" height="180" /> &nbsp; <strong>Note</strong> Struts&nbsp; an JSF like frame works are designed on the basis of model II web application architecture lie on the basis of MVC design pattern &nbsp; &nbsp;</p>49:T863,<h2><strong>MVC Rules and Regulation</strong></h2>
<p>&nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In MVC based web application controller must be a servlet and view part must be a set of JSP pages, we should not interchange those two components, &nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In MVC based web application we have to send all the requests to controller component only, not to view part, In MVC based web applications, only view part has to generate dynamic response to client, not controller. &nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In case of MVC based web application, both controller and view should not interact with data base directly, they have to interact with data base through model part only &nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In MVC based web application, controller should interact with model part only to set the data , not to get the data but view part should in with model part only to get the data, not to set he data &nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In MVC based web applications there is no restriction about no. of JSP Pages in view part but all he JSP Pages must be provided without java code &nbsp; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />In case of MVC web applications we can provide any no.of JSP pages in view parted but we must provide page controller page navigation, we must not provide page to page navigations, &nbsp;</p>4a:T233f,<p><strong>STEPS TO DESIGN FIRST JSF APPLICATION</strong> <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Prepare web application directory structure. In JSF based web applications, we have to provide the following jar files in application lib folder JSF- api.jar &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; JStl.jar JSF- impl.jar &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Standard.jar JSF- api.jar, JSF- impl.jar files are available in <strong>majarra</strong> -1.2 &ndash; 14 &ndash; library. Zip which we have to down load from <a href="http://www.javaserverfaces">www.javaserverfaces</a>. Java. Net website.</p>
<ul>
<li>Jar and standard. Jar files are provided by tomcat 7.0 folder server under c:\ tomcat 7.0/ web apps/examples/WEB-INF/Lib</li>
</ul>
<p><img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />&nbsp;Prepare user interface by using JSF Provided log library <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />&nbsp;Prepare java resources like managed bean classes, DAos, Action classes,&hellip; <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />&nbsp;Prepare configuration file, we must require XSD in order to locate XML tags library and to parse xml tags</p>
<ul>
<li>To get faces configuration file XSD, we have to use the following path.</li>
</ul>
<p>Extract JSF-&nbsp; Impl.jar file&agrave;com&agrave; sun&agrave; faces&agrave; web &ndash; faces config &ndash; 1 -2. Xsd Copy&lt;Faces- config..&gt; tag [108 line in edit plus] from web-faces config-1-2.xsd. and use in our application faces configuration file <img class="alignnone wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Prepare web.xml file &nbsp; <img class="alignnone size-full wp-image-9982" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_1025.png" alt="Screenshot_10" width="460" height="521" /> &nbsp;</p>
<h2><strong>Helloform.jsp</strong></h2>
<p>&lt;%@ taglib url=<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</a>prefix=&rdquo;f&rdquo;%&gt; /html:&rdquo; prefix=&rdquo;h&rdquo;%&gt; &lt;j:view&gt; &lt;html&gt; &lt;body bgcolor=&rdquo;light yellow&rdquo;&gt; &lt;h:form&gt; &lt;h:panel grid columns=&rdquo;2&rdquo;&gt; &lt;h:output text value=&rdquo;user name&rdquo;/&gt; &lt;h:input text id=&rdquo;u name&rdquo; value=&rdquo;#{hello bean. U name}&rdquo;/&gt; &lt;h:command button value=&rdquo;say hello&rdquo; Action=&rdquo;#&rdquo;{ hello bean. say hello }&rdquo;/&gt; &lt;/h:parel grid&gt; &lt;/h:from&gt;&lt;/body&gt; &lt;/html&gt;&lt;/f:view&gt; <strong>&nbsp;</strong></p>
<h2><strong>&nbsp;</strong><strong>Wish.jsp</strong></h2>
<p>&lt;%@taglib url=&rdquo;<a href="http://java.sun.com/jsf/core">http://java.sun.com/jsf/core</a>&rdquo;prefix=&rdquo;f&rdquo;%&gt; /html:&rdquo; prefix=&rdquo;h&rdquo;%&gt; &lt;f:view&gt; &lt;html&gt; &lt;body bg color=&rdquo;light yellow&rdquo;&gt; &lt;font size=&rdquo;7&rdquo; color=&rdquo;red&rdquo;&gt; Hello&hellip;&lt; h: output text value=&rdquo;#{ hello bean. U name}&rdquo;/&gt; &lt;/font&gt; &lt;/body&gt; &lt;/html&gt; &lt;/f:view&gt; &nbsp;</p>
<h2><strong>Hello bean.java</strong></h2>
<p>Package com. &nbsp;soft; Public class Hello bean { Private string u name; Public void set u name(string u name) { This. u name= u name; } Public string&nbsp; get u name() { Return u name; } Public string &nbsp;say hello() { Return &rdquo;wish&rdquo;; } &nbsp;</p>
<h2><strong>Faces-config.xml</strong></h2>
<p>&lt;faces- config.xml &gt; ---------- &lt;managed-bean&gt; &lt;managed-bean-name&gt; Hello bean&lt;/managed-bean-name&gt; &lt;managed- bean- class&gt;com. soft. Hello bean&lt;/managed-bean- class &gt; &lt;managed- bean- scope&gt;session&lt;/managed-bean- scope &gt; &lt;managed- bean&gt; &lt;navigation-rule&gt; &lt;from-view -id&gt;/hello from.jsp&lt;/from-view-id&gt; &lt;navigation-case&gt; &lt;from-outcome&gt;wish&lt;/from- outcome &gt; &lt;to-view-id&gt;/wish.id&lt;/from- outcome &gt; &lt;/navigation-case&gt; &lt;/navigation- rule &gt; &lt;/faces. config&gt; &nbsp;</p>
<h2><strong>Web.xml</strong></h2>
<p>&lt; Web -app&gt; &lt;servlet&gt; &lt;servlet-name&gt;faces servlet&lt;/servlet- name &gt; &lt;servlet-class&gt;javax. Faces. webapp. Faces servlet&lt;/servlet- class &gt; &lt;load-on-stratup&gt;1&lt;/road-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet- name &gt; Faces servlet &lt;/servlet- name &gt; &lt;url-patternny*.dss&lt;/url- pattern &gt; &lt;/servlet-mapping&gt; &lt;\ Web -app&gt; &nbsp; <img class="alignnone size-full wp-image-9983" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_1026.png" alt="Screenshot_10" width="428" height="641" /> &nbsp;</p>
<h2><strong>Index.html</strong></h2>
<p>&lt; html&gt; &lt; head&gt; &lt; meta http-equiv=&rdquo;Refresh&rdquo; context=&rdquo;; URL-http://localhost:1010/log in app/log in form.dss&rdquo;&gt; &lt; /head&gt; &lt; body&gt; &lt; h1&gt; &lt; font color=&rdquo;red&rdquo;&gt; Application is loading&hellip;. &lt; /font&gt; &lt;/h1&gt; &lt; /body&gt; &lt; /html&gt; <strong>&nbsp;</strong> <strong>&nbsp;</strong></p>
<h2><strong>Login form. Jsp</strong></h2>
<p><a href="mailto:%25@taglib%20url=">%@taglib url=&rdquo;http://JAVA.sun.com/JSF/CORE&rdquo;prefix=&rdquo;f&rdquo;%</a> /html &rdquo;prefix=&rdquo;h&rdquo;%&gt; &nbsp; &lt; f:view&gt; &lt; html&gt; &lt;body log color=&rdquo;light yellow&rdquo;&gt; &lt;font color=&rdquo;blue&rdquo;&gt; &lt;h1&gt;software sol n &lt;/h1&gt; &lt; h2&gt;Login form&lt;/h2&gt; &lt; /font&gt; &lt;h:form&gt; &lt;font color=&rdquo;red&rdquo;&gt; &lt;h1&gt; &lt;h:out put text value=&rdquo;#{log in bean. error- msg}&rdquo;/&gt; &lt;h1&gt; &lt;h:out put text value=&rdquo;#{log in bean. error- msg}&rdquo;/&gt; &lt;/h1&gt; &lt;h:panel Grid column=&rdquo;2&rdquo;&gt; &lt;h:out put text value=&rdquo;user name&rdquo;/&gt; &lt;h:in put text id=&rdquo;user name=&rdquo;#{log in bean. uname}&rdquo;/&gt; &lt;h: out put text value=&rdquo;password&rdquo;/&gt; &lt;h:in put text id=&rdquo;upwd&rdquo;value=&rdquo;#{log in bean. upwd }&rdquo;/&gt; &lt;/h:panel Grid&gt; &lt;/h:form&gt; &lt; /body&gt; &lt;/html&gt; &lt; /f:view&gt; &nbsp;</p>
<h2><strong>Home.jsp</strong></h2>
<p>&lt;%@taglib url=&rdquo;http://java.sun.com/jsf/core&rdquo;prefix=&rdquo;f&rdquo;%&gt; &lt; f:view&gt; &lt;html&gt; &lt; body log color=&rdquo;Light yellow&rdquo;&gt; &lt; font color=&rdquo;red&rdquo;size=&rdquo;7&rdquo;&gt; &lt; bre&gt;&lt; bre&gt;&lt; bre&gt; Welcome to&nbsp; soft &lt; bre&gt; &lt;\font&gt; &lt;\ body &gt; &lt;\ html &gt; &lt;\ f:view &gt; &nbsp;</p>
<h2><strong>Login Bean. Java</strong></h2>
<p>Package com. soft; Public class login bean { Private string u name; Private string upwd; Private string err-msg; Public void set u name(string u name) { This. U name= u name; } Public string get u name() { Return u name; } Public void set u pwd(string upwd) { This. Upwd= upwd; } Public string get upwd() { Returns upwd; } Public void set err &ndash; msg(string err-msg) { This. Err &ndash; msg= err-msg; } Public string get err- msg() { Return err-msg; } Public string check log in () { If (u name. equals(&ldquo;durga&rdquo;)&amp;&amp; upwd. Equals(&ldquo;durga&rdquo;)) { Return &rdquo;success&rdquo;; } Else { Set err-msg(&ldquo;Invalid username and password&rdquo;); Return&rdquo;failure&rdquo;; } } } Faces-config.xml:- &lt;faces-config&mdash; ---xsd &lt;managed-rule&gt; &lt;managed-bean-name&gt;log in bean&lt;/ managed-bean-name &gt; &lt;managed-bean-scope&gt;session&lt;/ managed-bean- scope &gt; &lt;/ managed-bean &gt; &lt;navigation-case&gt; &lt;from-outcome&gt;success&lt;/from-out come&gt; &lt;to-view-id&gt;/home.jsp&lt;/to-view-id&gt; &lt;navigation-case&gt; &lt;navigation-case&gt; &lt;from-outcome&gt;failure&lt;/frin-outcome&gt; &lt;to-view-id&gt;/log in from.jsp&lt;/to-view-id&gt; &lt;navigation-case&gt; &lt;\navigation-rule&gt;&lt;\faces-config&gt; &nbsp;</p>
<h2><strong>Web.xml</strong></h2>
<p>&lt;web-app&gt; &lt;servlet&gt; &lt;servlet-name&gt;faces servlet&lt;\servlet-name&gt; &lt;servlet-class&gt;Java x. faces.web app. faces servlet &lt;servlet-class&gt; &lt;load-on-startup&gt;1&lt;load-on-startup&gt; &lt;servlet&gt; &lt;servlet- mapping&gt; &lt;servlet- name&gt;faces servlef&lt;/servlet-name&gt; &lt;url- pattern&gt;*.dss&lt; /url- pattern &gt; &lt;/servlet- mapping&gt; &lt;/web.app&gt; <strong>&nbsp;</strong> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>4b:T2886,<h2><strong>STEPS TO DESIGN JSF 1.2 APPLICATION IN ECLIPSE IDE</strong></h2>
<p><strong>Step1 -</strong> Prepare dynamic web project with JSF library <strong>Step2 -</strong> Prepare application specific components like JSP PAGES Managed Beans,&hellip;.etc <strong>Step3 -</strong>Run the application &nbsp;</p>
<h2><strong>Prepare Dynamic web project</strong></h2>
<p>File<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />New<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Dynamic web project<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Project name:JSF app1 <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Prepare target runtime<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />click on new runtime<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select apache tomcat 7.0&agrave;Next&agrave;provide tomcat&lt;home&gt;dire:c:/tomcat7.0<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />finish Dynamic web module version:3.0 or 2.5<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />configuration: Modify<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Select &amp;change java server faces from 2.2 to 1.2 and select the respective check box<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> save as <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />provide name jstlib1.2<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> ok<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />ok Next<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />next<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> select&thorn;Generate web.xml deployment descriptor <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Next<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />click on manage library icon<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> new<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> provide user library Name:JSFlib1.2<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />ok<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select JSflib 1.2<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> add external jars JSf-api.jar JSf-IMPL.jar JSTL.JAR Standard.jar<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />ok<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select&thorn;JSFlib 1.2<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />changes url mapping pattern :.dss<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> finish <strong>Note:-</strong> With the above steps we are able to prepare Jsf app1 project with the default files web.xml and faces-config.xml &nbsp;</p>
<h2><strong>Prepare application Required Resources</strong></h2>
<p><strong>Loginform.JSP:-</strong> Right click on &ldquo;web content &rdquo;folder&agrave; new <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select JSP file<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> provide file name: Loginform.jsp<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />next<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select new java Server Faces(JSF)page (html)<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />finish <strong>Note:</strong> With these steps log in form.jsp page will be generated, edit log in form.jsp page as per requirement. Similarly success.jsp and failure.jsp &nbsp;</p>
<h2><strong>Log in Bean. Java</strong></h2>
<p>Java Resources<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />ser<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Right click on src<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />new <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />class<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" /> package name:car,durgasoft Class name: log in bean <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />&nbsp;finish With the above steps a class will be created in work area *Declare required properties Right click on either of the property Select &rdquo;sources&rdquo;<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select getter and setter<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />select all<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />ok with the above steps a bean component will be prepared with setter and getters here we have to declare business method with the application logic *Provide bean configuration and its navigation rules in faces-config.xml files as per the requirement &nbsp;</p>
<h2><strong>Run JSF Application</strong></h2>
<p>Right click on project()stapp1)<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Run as<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Run as server<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Next<img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Finish With these steps IDE will start server and it will access current application by opening browser. <img class="alignnone size-full wp-image-9386" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/220.png" alt="2" width="30" height="12" />Manually provide/log in.dss in url <a href="http://local">http://local</a> host:1010/JSf app1/loginform.dss &nbsp; &nbsp;</p>4c:T1a8a,<h2>&nbsp;Developing Registration Application</h2>
<p><img class="alignnone wp-image-9985" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_1124-460x447.png" alt="Screenshot_11" width="501" height="486" /> &nbsp;</p>
<h2><strong>Index.html</strong></h2>
<p>&lt;html&gt; &lt;head&gt; &lt;meta http equiv=&rdquo;Refest&rdquo;name=&rdquo;Generater&rdquo;content=&rdquo;2,url=http://localhost:1010/requestion app/registration form.dss&rdquo;&gt; &lt;/head&gt; &lt;body&gt; &lt;br&gt;&lt;br&gt; &lt;center&gt; &lt;font size=&rdquo;6&rdquo;color=&rdquo;red&rdquo;&gt; Application is loading &lt;/font&gt; &lt;/center&gt; &lt;/ body &gt; &lt;/html&gt; <strong>&nbsp;</strong><strong>&nbsp;</strong> <strong>&nbsp;</strong></p>
<h2><strong>Registration form.jsp</strong></h2>
<p>&lt;% @tag lib url=<a href="http://JAVA.SUN.COM/JSF/CARE">http://JAVA.SUN.COM/JSF/CARE</a>&rdquo;Prefix=f&rdquo;%&gt; /html&rdquo; Prefix=&rdquo;h&rdquo;%&gt; &lt;f:view&gt; &lt;html&gt; &lt;body&gt; &lt;font color=&rdquo;red&rdquo;&gt; &lt;h1&gt; software solutions&lt;/h1&gt; &lt;h2&gt;student Registration form&lt;/h2&gt; &lt;/font&gt; &lt;h:form&gt; &lt;h:panel grid column=&rdquo;2&rdquo;bg color=&rdquo;Light blur&rdquo;&gt; &lt;h:out put text value=&rdquo;student id&rdquo;/&gt; &lt;h:in put text id=&rdquo;sid&rdquo; value=&rdquo;#{student id}&rdquo;/&gt; &lt;h:out put text value=&rdquo;student name&rdquo;/&gt; &lt;h:in put text id=&rdquo;s name&rdquo; value=&rdquo;#{student Bean.sname}&rdquo;/&gt; &lt;h:out put text value=&rdquo;student mail&rdquo;/&gt; &lt;h:in put text id=&rdquo;se mail&rdquo; value=&rdquo;#{student Bean.se mail }&rdquo;/&gt; &lt;h:out put text value=&rdquo;student mobile&rdquo;/&gt; &lt;h:in put text id=&rdquo;smobile &rdquo; value=&rdquo;#{student Bean. smobile }&rdquo;/&gt; &lt;h:command button value=&rdquo;ADD&rdquo;action==&rdquo;#{student Bean. add }&rdquo;/&gt; &lt;h:panelGrid&gt; &lt;/h:from&gt; &lt;/body&gt; &lt;/html&gt; &lt;/f:view&gt; &nbsp;</p>
<h2><strong>Existed.html</strong></h2>
<p>&lt;%@ taglib------------------- &ldquo;f&rdquo;%&gt; &lt;%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&ldquo;h&rdquo;%&gt; &lt;/f:view&gt; &lt;html&gt; &lt;body bgcolor=&rdquo;Light yellow&rdquo;&gt; &lt;br&gt;&lt; br &gt; &lt;center&gt; &lt;b&gt;&lt;font size=&rdquo;6&rdquo;color=&rdquo;red&rdquo;&gt; Student already existed. &lt;/font&gt; &lt;/b&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; &lt;/f:view&gt; &nbsp;</p>
<h2><strong>Success.jsp</strong></h2>
<p>&lt;%@taglib--------&gt; &lt;%@taglib--------&gt; &lt;f:view&gt; &lt;html&gt; &lt;body bgcolor=&rdquo;light yellow&rdquo;&gt; &lt;font size=&rdquo;6&rdquo;color=&rdquo;green&rdquo;&gt; Student registered successfully.. &lt;/font&gt; &lt;/body&gt;&lt;/html&gt;&lt;/f:view&gt; <strong>&nbsp;</strong></p>
<h2><strong>Failure.jsp</strong></h2>
<p>&lt;%@tag---- &lt;% ---- &lt;f:view&gt; &lt;html&gt; &lt;body bgcolor=&rdquo;red&rdquo;&gt; &lt;font size=&rdquo;8&rdquo;color=&rdquo;green&rdquo;&gt; Student registration failed&mdash; &lt;/font&gt; &lt;/body&gt; &lt;/html&gt;&lt;/t:view&gt; &nbsp;</p>
<h2><strong>Student Bean.java</strong></h2>
<p>Package com. soft; Public class student bean{ Private string sid: Private string sname; Private string semail; Private string smobile; Set&mdash;() &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //provide setter and getter() Getter&mdash;() Student action sa=new studentAction(); String status =sa. Addstudent(sid,sname,semail,smobile); Return status; } } &nbsp;</p>
<h2><strong>Student action.java</strong></h2>
<p>Package com. soft; Import java.sql.*; Public class studentAction { String status=&rdquo;&rdquo;; Public string add student(string sid, string sname string email, string smobile) { Type{ Connection con=jdbcultil. get connection(); Prepared statement pst=con. prepared statement(&ldquo;select* from student where sid=?&rdquo;); Pst.set string (1,sid); Resultset ms=pst execute query(); Boolern b=ms.next(); If()b==true) { Status=&rdquo;existed&rdquo;; } Else{ Pst=con. Prepare statement(&ldquo;insert into student values(????)&rdquo;); Pst. setstring(1,sid); Pst. setstring(2,sname); Pst. setstring(3,semail); Pst. setstring(4,smobile); Pst. Execute update(); Status=&rdquo;Success&rdquo;; } } Catch(exception() { Status=&rdquo;failure&rdquo;; e.print stack ace () } Return status; } } &nbsp;</p>
<h2>Jdbcutil.java</h2>
<p>Package com.durgasoft; Import java.sql*; Public class Jdbcutil { Static connection con; Static { Try { Class. fore name(&ldquo;oracle. jdbc. oracle drivet&rdquo;); Con=Driver manager. Get connection(&ldquo;jdbc:oracle; thin:@local host:1521: oricle&rdquo;,&rdquo;scot&rdquo;,&rdquo;tiger&rdquo;); } Catch(exception) { e.printstacture(); } } Public static connection get connection() { Return com; } } &nbsp;</p>
<h2><strong>Faces-config.xml</strong></h2>
<p>&lt;facs.config=xsd&gt; &lt;managed. bean&gt; &lt;managed. Bean.name&gt;student bean&lt;/managed-bean-name&gt; &lt;managed. Bean. class&gt;com. soft. student bean&lt;/managed-bean- class &gt; &lt;managed. Bean. scope&gt;session&lt;/managed-bean- scope &gt; &lt;managed. Bean&gt; &lt;navigation. rule&gt; &lt;from-view-id&gt;/registrationfrom.jsp&lt;/from-view-id&gt; &lt;navigation-case&gt; &lt;from-outcome &gt;success&lt;&lt;/from &ndash;outcome&gt; &lt;to-view-id&gt;/success.jsp&lt;/ to view-id&gt; &lt;/navigation. case&gt; &lt;from-outcome&gt;success&lt;/from-outcome&gt; &lt;to-view-id&gt; /success.jsp&lt;/to-view-id&gt; &lt;/navigation. case&gt; &lt;navigation. case&gt; &lt;from-outcome&gt;failure&lt;/from-outcome&gt; &lt;to-view-id&gt; / failure.jsp&lt;/to-view-id&gt; &lt;/navigation. case&gt; &lt;navigation. case&gt; &lt;from-outcome&gt;failure&lt;/from-outcome&gt; &lt;to-view-id&gt; / existed.jsp&lt;/to-view-id&gt; &lt;/navigation. case&gt; &lt;/navigation. rule&gt; &lt;/faces. config&gt; &nbsp;</p>
<h2><strong>Web.xml</strong></h2>
<p>&lt;web-app&gt; &lt;servlet&gt; &lt;servlet-name&gt;faces servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;Javax. faces. webapp. faces servlet&lt; /servlef-class &gt; &lt;load-on-startup&gt;1&lt;/ load-on-startup &gt; &lt;servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt; faces servlet&lt; servlet-name&gt; &lt;url-pattern&gt;*.dss&lt;url-pattern&gt; &lt;servlet-mapping&gt; &lt;/web-app&gt;</p>4d:T11f6,<h2>&nbsp;DIFFERENCE BET N JSF1.X &amp;JSF 2.X</h2>
<p>&nbsp;</p>
<table style="width: 699px; height: 285px;" border="1" cellspacing="1" cellpadding="1">
<tbody>
<tr>
<td style="text-align: center;"><strong><span style="text-decoration: underline;">JSF1.X</span></strong></td>
<td style="text-align: center;"><strong><span style="text-decoration: underline;">JSF 2.X</span></strong></td>
</tr>
<tr>
<td>1.in JSF 1.X version config file is mandatory and annotation is not supports</td>
<td>1.In this JSF config file is optional and in place of config file we are able to use annotations.</td>
</tr>
<tr>
<td>1)To represent managed bean metadata, we have to use the following annotations on the top of managed bean class</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp; a) Managed bean(name=&rdquo;---&rdquo;) Where &rdquo;name&rdquo; member will take logical name of the managed bean class This annotation will be pre presented by a predefined&nbsp; interfaces javax.faces.bean. managed beam 2)@xxX scoped Eg: @session scoped @Application scoped @page scoped @Request scoped This annotation can be used to represent a particular scope fore the managed bean</p>
<ol>
<li>ii) In JSF 1.X We are able to use only JSP pages to prepare user interface</li>
</ol>
<p>In JSF 2.x Version we are able to use both Jsp &amp; xhtml pages to prepare users interface. In case of JSF 1.X version F/W is using explicit navigation system, it must require navigation rules configuration in faces-config.xml file explicitly in order to forward request to target page In case of JSF 2.X Version. f/w has an implicit navigation system it should not require explicit &ldquo;navigation rules&rdquo; configuration from faces-config.xml file. It will forward request to&nbsp; the target pages on the basis of the return value from action method defined in the respective managed bean component. &nbsp; <strong>Note:</strong> It the return value from action method is &ldquo;success&rdquo; then implicit navigation system will forward request to either success jsp or success. Xhtml file. 4) In case of JSF 1.X version support is available but we have to provide some explicit configuration. In case of JSF 2.x version supported is inbuilt, it shouldn&rsquo;t require any explicit configuration.</p>
<ol start="5">
<li>In JSF 1.x Version face lets tag library is not good in JSF 2.X Version, face lets supported cs very good to provide compositions.</li>
</ol>
<p>&nbsp; <img class="alignnone wp-image-9993" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_1513-460x367.png" alt="Screenshot_15" width="609" height="485" /> &nbsp; &nbsp;</p>
<h2><strong>Hello.xhtml</strong></h2>
<p>&lt;html xmlns=<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a> Xmln:f=&rdquo;http:java.sun.com/jsf/core&rdquo; Xmln:h=&rdquo;http:java.sun.com/jsf/html&rdquo; &gt; &lt;f.view&gt; &lt;h:form&gt; &lt;h:panel grid columns=&rdquo;2&rdquo;&gt; &lt;h: output text value=&rdquo;user name&rdquo;/&gt; &lt;h:input text id=&rdquo;u name&rdquo;value=#{user bean. Uname&rdquo;/} &lt;h:command button value=&rdquo;say hello&rdquo; action=#{user bean say hello}&rdquo;/&gt; &lt;/h:panelgrid&gt; &lt;/h:form&gt;&lt;/f:view&gt;&lt;/html&gt; &nbsp;</p>
<h2><strong>Wish.xhtml</strong></h2>
<p>&lt;html xmlns=&rdquo;http//www.w3.org/1999/xml&rdquo; Xmln:f=&rdquo;http//java.sun.com/jsf/core&rdquo; Xmln:h=&rdquo;http//java.sun.com/jsf/html&rdquo;&gt; &lt;f:view&gt; &lt;h1&gt; &lt;h:output text value=&rdquo;Hello----&rdquo;/&gt;&lt;h:output text value- &ldquo;#{userBean.u name}&rdquo;/&gt; &lt;/h1&gt; &lt;/f:view&gt;&lt;/html&gt; <strong>&nbsp;</strong></p>
<h2><strong>&nbsp;</strong><strong>User Bean.java</strong></h2>
<p>Package com. soft Import javax. faces. bean. managed beans; Import javax. faces. bean. Session scoped; @managed bean(name=&rdquo;user bean&rdquo;) @session scoped Public class user Bean{ Private string uname; Public setting getuname(){ Return u name; } Public void set u name(String uname){ This. U name=u name; } Public string say Hello(){ Return &rdquo;wish&rdquo;; } } &nbsp;</p>
<h2><strong>Web.xml</strong></h2>
<p>//same as prev.example &lt;web-app&gt; &lt;servlet&gt; &lt;servlet-name&gt;faces servlet&lt;/servlet-name&gt; &lt;servlet-class&gt;javax.faces.webapp. faces servlet&lt;/servlet class&gt; &lt;load-on-startup&gt;1&lt;/load.on.strtup&gt; &lt; /servlet &gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;faces servlet&lt;/servlet-name&gt; &lt;url-patterny*.dss&lt;/url-pattern&gt;&gt; &lt;/servlet-mapping&gt; &lt;/web-app&gt; &nbsp; &nbsp;</p>4e:T1641,<h2><strong>Introduction</strong></h2>
<h3>Enterprise &amp; Enterprise Application:-</h3>
<ol>
<li>Presentation layers</li>
<li>Business layers</li>
<li>Persistence layers</li>
</ol>
<p>&nbsp; <img class="alignnone wp-image-9960" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_189-460x201.png" alt="Screenshot_1" width="722" height="315" /> &nbsp; JSF is exclusively designed for only presentation layers. Struts main focus in controllers (How to control the web apply) <strong>&nbsp;</strong> <strong>Enterprise application</strong></p>
<ul>
<li><strong>Enterprise</strong>
<ul>
<li>Is a business organization or a group at org. running under a single level.</li>
</ul>
</li>
<li><strong>Enterprise Apply</strong>
<ul>
<li>it is a s/w apply designed for a particular enterprise in over to simplify theirs business full and regulations.</li>
</ul>
</li>
</ul>
<p>&nbsp; To design enterprise application we have to provide the following 3 Layers</p>
<ol>
<li>Presentation Layers</li>
<li>Business processing layers</li>
<li>Persistence layer data storage and Access layers</li>
</ol>
<p>&nbsp;</p>
<ol>
<li><strong>Presentation Layers</strong></li>
</ol>
<p>The main purpose of presentation layers in enterprise appon is,</p>
<ol>
<li>To improve look and feel for the enterprise appl n</li>
<li>To accept the data from user in order to execute enterprise application.</li>
<li>To perform client side data validations by using java script functions.</li>
<li>To specify deferent types at request like GET. POST&hellip; TO prepare presentation layer in enterprise applications. We have to provide a separate logic called as presentation logic.</li>
</ol>
<ul>
<li>To provide presentation logic, we have to we the tech like AWT, swing, HTML, JCP free market, velocity&hellip;</li>
</ul>
<p>&nbsp;</p>
<ol start="2">
<li><strong> Business processing Layers</strong></li>
</ol>
<p>It is the heart of enterprise appl n. it will provide very good env&hellip; To define and execute business rule and regulation what actually client required.</p>
<ul>
<li>To prepare this layer, we have to provide business logic</li>
<li>To prepare B-logic in enterprise application development, we have to use the tech. like servlet, Ejbs, Bean components.</li>
</ul>
<p>&nbsp;</p>
<ol start="3">
<li><strong> Persistence Layer</strong></li>
</ol>
<p>This Layer main intention is to provide env. To interact with data base and to provide data persistence.</p>
<ul>
<li>To prepare this layer in enterprise application, we have to use the tech. like JDBC, Hibernate, EJBS Entity Beans, JPA, Open JPA&hellip;..</li>
</ul>
<p>&nbsp; <strong>System Architecture</strong> To design enterprise application First we have to define the degree are height of the enterprise application on the basic at application Requirement</p>
<ul>
<li>To define enterprise application height, we have to use system architecture</li>
</ul>
<p>&nbsp; <strong>1-Tier Architecture</strong> It will specify to design and execute enterprise application within a single machine i.e we have to provide presentation logic, business logic and persistence logic with in a single machine</p>
<ul>
<li>In the above context, single machine me sources may not be sufficient to execute enterprise applicator.</li>
<li>1- tier architecture is suggestible for only stand alone application no1 for enterprise application</li>
<li>1-Tier architecture will not provide sharability</li>
<li>1-Tier architecture will provide . tightly coupled design for the enterprise application</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-9961" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_250-460x194.png" alt="Screenshot_2" width="498" height="209" /> &nbsp; <strong>TIERE ARCHITECTURE</strong> This arch is the conventional architecture. Fore the enterprise application</p>
<ul>
<li>This architecture will provide two layers of machines to distribute enterprise application.</li>
<li>If we design enterprise application in 2-tier arch then we have to provide presentation logic tiere-2 systems.</li>
<li>The best example for 2. Tier Arch is client- server arch.</li>
<li>2-tier arch will provide loosely coupled design for the enterprise applications.</li>
<li>2 Tier arch will provide multi users env</li>
<li>2 tier arch. will improve database sharability when compared with 1-tier architecture</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-9962" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_350-460x153.png" alt="Screenshot_3" width="515" height="170" /> &nbsp; <strong>Tier Architecture</strong></p>
<ul>
<li>This arch. Will provide there layers of machine to distribute enterprise application.</li>
<li>In case of 3- Tier arch, tier-1 systems will manage presentation logic, tier-2 systems will manage business layer and tier -3 systems will manage persistence layer</li>
<li>When compared with 1-tier arch and 2- tier arch., 3- Tier arch. Will improve data base sharability and application server components sharability.</li>
<li>3-tier arch. Will provide more losly coupled design for the enterprise application.</li>
<li>3- tier arch is the frequently used arch. Fore the enterprise application</li>
</ul>
<p>&nbsp; <img class="alignnone wp-image-9963" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2014/12/Screenshot_440-460x108.png" alt="Screenshot_4" width="549" height="128" /> &nbsp; <strong>Note-</strong> It we increase no of fires in enterprise application their flexibility will be increased to design enterprise application but maintenance cost will be increased</p>4f:T6ed7,<p style="text-align: justify;">Welcome to the Java Tutorials. The objective of these tutorials is to provide in depth understand of java from basic questions like what is java tutorial, core java, where it is used, what type of applications are created in java and why use java.</p>
<p style="text-align: justify;">In addition to free Java Tutorials, you can find interview questions, how to tutorials and issues and their resolutions of Java.</p>
<h2><span style="color: #000000;">JAVA Introduction</span></h2>
<p>Java is a programming language that was created by James Gosling from Sun Microsystems (Sun) in 1991 and first made publicly available in 1995, after Sun Microsystems was inherited by Oracle. The platform was originally designed for interactive television, but it surpassed the technology and design of the digital cable television industry at the time. Today, Java remains an open-source programming language that falls under the GPL (General Public License) The language derives much of its syntax from C and C++, but lacks the power of those languages because it asks less of the user (less customization, more simplicity). For example, tasks such as garbage collection (the process of reducing memory being used by the program) are automated in Java. Five principles were used in the creation of the Java programming language:</p>
<ul style="list-style-type: disc;">
<li>It must be simple, object-oriented, and familiar</li>
<li>It must be robust and secure</li>
<li>It must be architecture-neutral and portable</li>
<li>It must execute with high performance</li>
<li>It must be interpreted, threaded, and dynamic</li>
</ul>
<p>Java was built as an exclusively object-oriented programming language&mdash;which doesn&rsquo;t mean much right now, but will later in this guide. For now, suffice it to say that object-oriented programming allows for the creation of efficient, organized, and powerful code. Simply put, Java is a multithreaded, object-oriented, platform-independent programming language. This means that Java programs can perform multiple tasks using object-oriented concepts that can work across all platforms and operating systems. It is the most important factor distinguishing Java from other languages. Java helps us to develop normal desktop applications, mobile applications, and web applications using separate packages such as the J2ME package for mobile application development and the J2EE package for web application development. In this guide, we are going to learn the basics of object-oriented concepts as they apply to Java programming. We have two different types of application development concepts in Java: console-based application and GUI application development. Let&rsquo;s see how to develop these types of applications using Java.</p>
<h2><span style="color: #000000;">What is Java?</span></h2>
<p>Java is a programming language that is supported by all devices, whether it is an Android phone, a Windows computer, or an Apple product. Java&rsquo;s flexibility has made it one of the most popular programming languages around the globe. Java can be used to create web applications, games, Windows applications, database systems, Android apps, and much more. Java&rsquo;s combined simplicity and power makes it different from other programming languages. Java is simple in that it doesn&rsquo;t expect too much from the user in terms of memory management or dealing with a vast and complex hive of intricate classes extending from each other. Although this doesn&rsquo;t make much sense right now, it will once we start learning about inheritance in Java. A Java program is run through a Java Virtual Machine (JVM), which is essentially a software implementation of an operating system that is used to execute Java programs. The compiler (process of converting code into readable instructions for the computer) analyzes the Java code and converts it into byte code, which then allows the computer to understand the instructions issued by the programmer and execute them in the appropriate manner. The distribution of the Java platform comes in two packages: the Java Runtime Environment (JRE) and the Java Development Kit (JDK). The JRE is essentially the Java Virtual Machine (JVM) that runs Java programs. The JDK, on the other hand, is a fully featured software development kit that includes the JRE, compilers, tools, etc. <img class="aligncenter wp-image-27747" title="Learn JAVA Tutorials Online" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_23.jpg" alt="Learn JAVA Tutorials Online" width="783" height="338" /> A casual user who only wants to run Java programs on their machine would only need to install the JRE, as it contains the JVM that allows Java programs to be executed. However, a <a href="https://tekslate.com/functions-javascript/" target="_blank">Java&nbsp;<em>programmer</em></a>&nbsp;must download the JDK. We will explore these concepts in greater detail in the next part. As previously stated, Java programming creates an object-oriented and platform-independent program because the Java compiler creates a .class file instead of an .exe file. This .class file is an intermediate file that has byte code, and this is the reason why Java programs are platform independent. However, there are also disadvantages: Java programs take more time to complete their execution because the .class file must first load in the JVM before they are able to run in the OS. We can develop all kinds of applications using Java, but we need to use separate packages for separate application developments. For example, if you want develop a desktop application, then you need to use JDK; if you want to develop an Android application, then you need to use Android SDK, because they have different sets of classes.</p>
<h3><span style="color: #000000;">Java Language Structure</span></h3>
<p>We will now use this sample code as an example to start the Java learning process. This code should make it easy to understand the basic structure of a Java program.</p>
<pre style="padding-left: 30px;"><u>i</u>mport java.util.Scanner;
public class&nbsp;<u>ThisIsAClass</u>&nbsp;{
public static void main (String args[]) {
int x = 5;
System.<em>out</em>.println(x);
}
}</pre>
<p>The first line import java.util.Scanner; it is using the special keyword <u>i</u>mport, which allows the programmer to import tools in the Java library that aren&rsquo;t included by default when starting a new class. After the keyword&nbsp;<u>i</u>mport, the programmer specifies a specific directory within the Java library for the Scanner tool by typing out: java.util.Scanner, which first accesses the Java library in the Utilities directory before accessing the specific tool needed, which in this case is &ldquo;Scanner.&rdquo; By default, when starting a Java class, only the bare minimum tools and functions from the Java library that are needed for any basic program will be provided. For example, you don&rsquo;t need to import packages for a simple program. If the programmer wants to use more than just the basic functionalities, they must use the &ldquo;Import&rdquo; keyword to give themselves more tools to work with. You will also start to notice that there is a semicolon &ldquo;;&rdquo; after each statement. This semicolon functions as a period does for an English sentence. When the compiler is going through the program to prepare it for its execution, it will check for semicolons, so it knows where a specific statement ends and a new one starts. The next thing you&rsquo;ll notice in the sample code is: public class ThisIsAClass. There are three elements to this line that are very important to understand. public&mdash;Defines the scope of the class and whether or not other classes have access to the class. This may not make sense now, but you will gain a better understanding of what this means when we learn about &ldquo;Inheritance and Polymorphism.&rdquo; class&mdash;A class can be thought of as a &ldquo;section&rdquo; of code. For example:</p>
<p style="padding-left: 30px;">Section {everything here is the content of the section}</p>
<p>Again, you will gain a better understanding of how classes can be useful when we learn about Inheritance and Polymorphism. ThisIsAClass&mdash;This third and final element of this important line is &ldquo;ThisIsAClass,&rdquo; which is simply a custom name that the user can define. You can call this anything, as all it does is give the &ldquo;Section&rdquo; or &ldquo;Class&rdquo; a name.</p>
<pre style="padding-left: 30px;">Section:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
 &nbsp;&nbsp; Essay/Contents
}
 In code, it would be presented:
Class&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ThisIsAClass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
 Code
}

</pre>
<p>Another thing you may be scratching your head over are the curly braces: &ldquo;{&rdquo; and &ldquo;}.&rdquo; All that these characters do is tell the compiler where a specific section starts and ends. In English, this could be thought of as starting a sentence with a capital letter or indenting a new paragraph. One thing to note is that the spacing in code does not affect whether or not it works. However, it is conventional and efficient to write properly spaced code so that you and other programmers can read and understand it more easily. You will learn how to space as you read more sample code. Eventually, you will start to notice trends in how conventional spacing works in programming.</p>
<pre style="padding-left: 30px;">public static void main (String args[])&nbsp;<u>{
</u>int x = 5;
System.out.println(&ldquo;The number is&rdquo; + x);
<u>}
</u>}</pre>
<p>As shown in the above sample code, two curly braces are set in bold to indicate that they communicate with each other. Whatever is written between them is the &ldquo;Section&rdquo; or &ldquo;Class&rdquo; of name &ldquo;ThisIsAClass.&rdquo; The sample applies to the bold and underlined curly braces to indicate that they are separate section dividers for the section within the parent section. The parent section is again considered a class, whereas the section within the parent section is considered a sub-section, or a subclass, or the formal term, a method. A method is essentially a subclass that also has its own special elements, similar to a class but more specific. This contains four elements: a scope (public/private/protected), a return type, a name, and parameters. The scope, return type, and parameters are things you will understand better when we learn about Methods, along with Inheritance and Polymorphism.</p>
<ul>
<li style="padding-left: 30px;">public&mdash;Scope.</li>
<li style="padding-left: 30px;">static&mdash;Conventional keyword for the main method.</li>
<li style="padding-left: 30px;">void&mdash;Return type.</li>
<li style="padding-left: 30px;">main&mdash;Name of the method (you can call this anything, but in this case, the main method must always exist in every Java program because it is the starting point of the Java program).</li>
</ul>
<p>This method is a special method because it is named &ldquo;main&rdquo; and so it will be the first method that is called. The compiler always looks for the method named &ldquo;main&rdquo; at the process start. The main method must hold the following properties: &ldquo;public static void&rdquo; and have &ldquo;String args[]&rdquo; as the argument in the parameters. There can only be one main method in a Java project. The idea of the main method is that it will be the first method to be called, and so you can think of it as the home base for calling other methods and traveling to other classes (you will learn what this means later). For the remainder of this guide, your program must be written within this main method, as it is a special method that the compiler will always be looking for. The contents of this method will also be introduced when learning about &ldquo;Variables&rdquo; later on in this guide. For now, this brief explanation should be enough for you to understand what is going on: int x = 5;&mdash;A variable is being declared (a container) that is a type of integer (whole number), and it holds the value of five. The &ldquo;=&rdquo; is used to assign values to variables. System.out.println&mdash;This is a classic line that every beginner learns; all it does is print a line of text to the console. Example <img class="aligncenter wp-image-27734" title="JAVA Tutorials" src="https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/2016/12/Screenshot_999.jpg" alt="JAVA Tutorials" width="719" height="337" /> The console is where the program&rsquo;s output is placed in order for the programmer to test his or her program. The &ldquo;System.<em>out</em>.println&rdquo; line contains parenthesis and a string of text within those parentheses. The string of text must be surrounded by quotation marks in order for the program to know that it has to print out text instead of an actual variable like &ldquo;x.&rdquo; The reason the user can&rsquo;t just say: &ldquo;System.<em>out</em>.println(<em>&ldquo;The number is: x</em>&rdquo;);&rdquo; is because the program won&rsquo;t know if x is a variable or not. The program reads anything within quotation marks as a piece of text instead of a container holding a value. Therefore, the x must be outside of the quotation marks. Then again, you can&rsquo;t say System.<em>out</em>.println(<em>&ldquo;The number is:</em><em>&nbsp;</em>&rdquo; x<em>&nbsp;</em>); because the program needs a specific keyword to know that the piece of text and the variable are two entities that need to be joined or &ldquo;concatenated&rdquo; together. The &ldquo;+&rdquo; symbol is used to show that the string of text and the variable &ldquo;x&rdquo; are to be connected together; this will allow the program to output &ldquo;The number is: 5&rdquo; (without the quotation marks). That is why the line is: &ldquo;System.<em>out</em>.println(<em>&ldquo;The number is:</em><em>&nbsp;</em>&rdquo; + x<em>&nbsp;</em>);&rdquo; <strong>Commenting:</strong> Commenting is the final fundamental concept to understand in a programming language. Although it is not necessary, it can greatly help you and other programmers around you if you ever forget how the program works. This concept is used by programmers as an opportunity to explain their code using common English. A compiler will always ignore comments, as they aren&rsquo;t actual code. They are simply explanations that were written to help people understand what was programmed. In order to write a comment, you must use &ldquo;//&rdquo; or &ldquo;/*&rdquo; and &ldquo;*/.&rdquo; The &ldquo;//&rdquo; symbol is used to comment on one line. For example, if you were to explain what a certain variable was going to be used for, you would do the following:</p>
<p style="padding-left: 30px;">int x = 5; // this variable is going to be used to find the total money</p>
<p>The compiler will ignore the commented line, but will process int x = 5. However, you can&rsquo;t use the &ldquo;//&rdquo; symbol with the following:</p>
<p style="padding-left: 30px;">int x = 5; // this variable is going to be used to find the total money</p>
<p>This is because the &ldquo;//&rdquo; symbol is only used for one line, and the comment is on two lines. You could do:</p>
<p style="padding-left: 30px;">int x = 5; // this variable is going to be used to find the total money</p>
<p>As long as the comment is one line, it is fine. Anything on the line after that symbol is considered a comment. The other technique does the same thing as &ldquo;//&rdquo; except it supports multi-line commenting. You must start the comment with &ldquo;/*&rdquo; and end it with &ldquo;*/.&rdquo; Example:</p>
<p style="padding-left: 30px;">int x = 5; /* this variable is going to be used to find the total money */</p>
<h2><span style="color: #000000;">Variables</span></h2>
<h3><span style="color: #000000;">What is a Variable?</span></h3>
<p>A<a href="https://tekslate.com/javascript-variables-data-types/" target="_blank"> variable</a> is essentially a storage unit that holds a certain type of data. It is named by the programmer and used to identify the data it stores. A variable can usually be accessed or changed at any time. You can write information to it, take information from it, and even copy the information to store in another variable.</p>
<h4><span style="color: #000000;">Variable Types</span></h4>
<p>In Java, a variable has a specific type that determines what size it is and the layout of its memory. The Java language defines three types of variables.</p>
<h4><strong><span style="color: #000000;">Instance Variables</span></strong></h4>
<p>Instance variables are declared within a class but accessed outside of any method, constructor, or block. Instance variables are created with the keyword &ldquo;new&rdquo; and are destroyed when the object is destroyed. An instance variable is visible to all methods, constructors, and blocks within the class where it is declared. By giving a variable the keyword &ldquo;public,&rdquo; it can be accessed by subclasses within the class. However, it is recommended to set a variable&rsquo;s access modifier to &ldquo;private&rdquo; when possible. All instance variables have a default value, unlike local variables, which do not have default values. Example:</p>
<pre style="padding-left: 30px;">public class Test
{
public int num; // integer named&nbsp;<u>num
</u>public void dog()
{
num = 3;
}
}</pre>
<p>In this example, we declare the integer &ldquo;num&rdquo; outside of any method, and can easily access it within any method that is inside of the class &ldquo;Test.&rdquo;</p>
<h4><strong><span style="color: #000000;">Class/Static Variables</span></strong></h4>
<p>Static variables are declared outside of any method, constructor, or block, and are declared with the keyword &ldquo;static.&rdquo; If a variable is static, only one instance of that variable will exist, regardless of how many instances of the object are called. Static variables are rarely used except for constant values, which are variables that never change. Example:</p>
<pre style="padding-left: 30px;">public class Test
{
public static final int&nbsp;<em>num</em>&nbsp;= 3; // integer named&nbsp;<u>num
</u>public void dog()
{
System.<em>out</em>.println(<em>num</em>);
}
}</pre>
<p>In this example, we declare an int called &ldquo;<em>num</em>&rdquo; and it set to be public, static, and final. This means that it can be accessed from within subclasses, only one instance of it can ever exist, and the value can never be changed.</p>
<h4><strong><span style="color: #000000;">Local Variables</span></strong></h4>
<p>Local variables are only declared within methods, blocks, or constructors. They are only created when the method, block, or constructor is created, and then they are destroyed as soon as the method ends. You can only access local variables within the method, block, or constructor where it is called; they are not visible outside of where they are called. Local variables do not have a default value. Example: public void cat(){ // method named cat int x = 0; //&nbsp;<u>int</u>&nbsp;with value of 0 } In this example, a variable named &ldquo;x&rdquo; is called within the method &ldquo;cat.&rdquo; That variable only exists within the context of cat, and it cannot be directly called or accessed outside of that method.</p>
<h3><span style="color: #000000;">Data Types</span></h3>
<p>Variables are used to store data. Java has multiple built-in data types that are used to store predefined types of data. These data types are called primitive data types, and are the most basic data types in the Java programming language. You can also create your own data types, which we will go over later. Java has eight primitive data types.</p>
<h4><strong><span style="color: #000000;">Byte</span></strong></h4>
<p>The byte data type is an 8-bit signed two&rsquo;s complement integer. It has a default value of zero when it is declared, a maximum value of 127, and a minimum value of -128. A byte is useful when you want to save memory space, especially in large arrays. Example</p>
<p style="padding-left: 30px;">byte b = 1; // has a value of one</p>
<h4><strong><span style="color: #000000;">Short</span></strong></h4>
<p>The short data type is a 16-bit signed two&rsquo;s complement integer. Its maximum range is 32,767 and its minimum value is -32,768. A short is used to save memory or to clarify your code. Example:</p>
<p style="padding-left: 30px;">short s = 1; // has a value of one</p>
<h3><strong><span style="color: #000000;">Int</span></strong></h3>
<p>The int data type is a 32-bit signed two&rsquo;s complement integer. Its maximum value is 2,147,483,647 (2<sup>31</sup>&nbsp;-1) and its minimum value is -2,147,483,648 (-2<sup>31</sup>). Int is the most commonly used data type for integral numbers, unless memory is a concern. Example:</p>
<p style="padding-left: 30px;">int i = 1; // has a value of one</p>
<h4><strong><span style="color: #000000;">Long</span></strong></h4>
<p>The long data type is a 64-bit signed two&rsquo;s complement integer. Its maximum value is 9,223,372,036,854,775,807 (2<sup>63</sup>&nbsp;-1) and its minimum value is -9,223,372,036,854,775,808 (-2<sup>63</sup>). This data type is used when a larger number is required than would be possible with an int. Example:</p>
<p style="padding-left: 30px;">long l = 1; // has a value of one</p>
<h4><strong><span style="color: #000000;">Float</span></strong></h4>
<p>The floating point data type is a double-precision 64-bit IEEE 754 floating point. The min and max range is too large to discuss here. A float is never used when precision is necessary, such as when dealing with currency. Example:</p>
<p style="padding-left: 30px;">float f = 1200.5f; //value of one thousand two hundred, and a half</p>
<h4><strong><span style="color: #000000;">Double</span></strong></h4>
<p>The double point data type is a double-precision 64-bit IEEE 754 floating point. It is often the data type of choice for decimal numbers. The min and max range is too large to discuss here. A float is never used when precision is necessary, such as when dealing with currency. Example:</p>
<p style="padding-left: 30px;">double d = 1200.5d; // value of one thousand two hundred, and a half</p>
<h4><strong><span style="color: #000000;">Boolean</span></strong></h4>
<p>A boolean data type represents one bit of data. It can contain two values: true or false. It is used for simple flags to track true or false conditions. Example:</p>
<p style="padding-left: 30px;">boolean b = true; // has a value of true</p>
<h4><strong><span style="color: #000000;">Char</span></strong></h4>
<p>The char data type is a single 16-bit Unicode character. Its minimum value is &ldquo;<em>/u0000</em>&rdquo; (or 0) and its maximum value is &ldquo;<em>/uffff</em>&rdquo; (or 65,535 inclusive) Example:</p>
<p style="padding-left: 30px;">char c = 'w'; // returns the letter "w"</p>
<h4><strong><span style="color: #000000;">String</span></strong></h4>
<p>Another commonly used data type is called String. String is not a primitive data type, but it is a very commonly used data type that stores collection of characters or text. Example:</p>
<p style="padding-left: 30px;">String cat = "meow"; // sets value of cat to "meow"</p>
<p>This example gets a String named &ldquo;cat&rdquo; and sets it to the string of characters that spell out &ldquo;meow.&rdquo;</p>
<h4><strong><span style="color: #000000;">Declaring a Variable</span></strong></h4>
<p>The declaration of a variable has three parts: the data type, variable name, and the stored value. Note that there is a specific convention and set of rules that are used when naming variables. A variable name can be any length of Unicode letters and numbers, but it must start with a letter, the dollar sign &ldquo;$,&rdquo; or an underscore &ldquo;_,&rdquo; or else it will return a syntax error. It is also common naming convention to start the name with a lowercase letter, followed by each subsequent word starting with a capital letter. For example, in the variable named &ldquo;theName,&rdquo; the first word &ldquo;the&rdquo; starts with a lowercase letter, and each following word, in this case &ldquo;Name,&rdquo; starts with a capital letter. Example:</p>
<p style="padding-left: 30px;">int theName = 123; // value of 123</p>
<p>In the example above, the data type is int and the name of the variable is the &nbsp;Name. The value stored inside that variable is 123. You can also declare a variable without storing a value in it. Example:</p>
<p style="padding-left: 30px;">int name; // no value</p>
<p>You can do this if you choose to declare it later.</p>
<h4><strong><span style="color: #000000;">Using a Variable</span></strong></h4>
<p>After a variable is declared, then you can read its value or change it. After the variable has been initially declared, you can only reference it by its name; you only need to declare its data type when you are declaring the variable. Example:</p>
<p style="padding-left: 30px;">name = 2; // sets the&nbsp;<u>int</u>&nbsp;"name" to a value of 2</p>
<p>The example above sets the value of name to 2. Notice how I never restated the data type. Example:</p>
<p style="padding-left: 30px;">System.<em>out</em>.println(name); // prints the value of name to the console</p>
<p>This example reads the value of &ldquo;name&rdquo; and writes it to the console. Variables can also be added together for example. Example:</p>
<pre style="padding-left: 30px;">int a; // no value
int b = 1; // value of one
int c = 2; // value of two
a =&nbsp;b&nbsp;+&nbsp;c; // sets a to the value of b + c</pre>
<p>In the example above, we set the value of a to equal the value of b and c added together. The addition sign is known as an operator, which we are going to learn about in the following section. It is also possible to a certain extent to combine values of variables that are different data types. Example:</p>
<pre style="padding-left: 30px;">int&nbsp;<u>a</u>; // no value
float b = 1; // value of one
int c = 2; // value of two
a = (int) (b + c); // sets the&nbsp;<u>int</u>&nbsp;"name" to a value of b + c</pre>
<p>This example is just like the one before, except we have changed the data type of b from int to float. The only difference when adding them together is that we had to include something called a &ldquo;cast&rdquo; in the equation. What a cast does is simply let the compiler know that the value of (b + c) should be of the data type int. Note that for this example, if the value of b + c were to equal a decimal number (for example 3.2), the value of a would not be 3.2 but rather 3, because int does not support decimals.</p>
<h4><strong><span style="color: #000000;">Assignment</span></strong></h4>
<p>Using what we have learned about variables, we can now create a simple calculator to add numbers together for us. The first thing we will want to do is declare three variables: one to store the value, one to represent the first number we want to add, and one to represent the second number we want to add. We will declare these variables as double so that we can add decimal numbers: double a = 0; // stores value of addition double b = 3.55; // first number to add double c = 52.6; // second number to add Next, we will simply set the value of a to equal the value of b and c combined, and then print out the value of a. a = b + c; System.<em>out</em>.println(a); If you run this program, it will print out 56.15. Now you have created a very simple calculator. I highly encourage you to play around with this and test things for yourself. Change the data type of the variables, add more numbers together, and experiment to understand how things work. Our design of course tutorials and interview questions is practical and informative. At TekSlate, we offer resources to help you learn various IT courses. We avail both written material and demo video tutorials. For in-depth knowledge and practical experience explore <a href="https://tekslate.com/core-java-training/" target="_blank">Online Java&nbsp;Training.</a></p>2:["$","$Lb",null,{"data":{"trending":[{"id":2126,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":"","table_of_content":"$c","description":"$d","title":"Java Swing Tutorial","url_title":"java-swing-tutorial","image_url":"","meta_title":"Java Swing Tutorial | Introduction to Java Swing","meta_desc":"Swing is a GUI toolkit for Java programmers. This tutorial will teach you the basics of the Swing API and show you how to build a simple app.","views":541,"rating":4.3,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2022-11-01T06:59:35.000Z","updated_at":"2022-11-01T06:59:35.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":2125,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":"","table_of_content":"<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><a style=\"color: #000000;\" href=\"#why-java-stream\"><span style=\"font-weight: 400;\">Why Javastream?</span></a></span></li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><a style=\"color: #000000;\" href=\"#java-stream-operations\"><span style=\"font-weight: 400;\">JavaStream Operations</span></a></span></li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><a style=\"color: #000000;\" href=\"#method-types-and-pipelines\"><span style=\"font-weight: 400;\">Method types and pipelines</span></a></span></li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"color: #000000;\"><a style=\"color: #000000;\" href=\"#lazy-evaluation\"><span style=\"font-weight: 400;\">Lazy evaluation</span></a></span></li>\n</ul>","description":"$e","title":"Java Stream Tutorial","url_title":"java-stream-tutorial","image_url":"","meta_title":"Java 8 Stream Tutorial | Java Stream API Tutorial","meta_desc":"Java 8 Stream tutorial for beginners. Learn how to use Java streams with examples of intermediate and advanced level programming.","views":1456,"rating":4.2,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2022-10-31T07:50:13.000Z","updated_at":"2022-10-31T07:50:13.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":1},{"id":1261,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$f","title":"Stack using Linked List in Data Structures","url_title":"stack-using-linked-list-in-data-structures","image_url":"","meta_title":"Stack using Linked List in Data Structures [Updated 2023]","meta_desc":"Stack using Linked List in Data Structures - Here is the simple program to demonstrate Stack using Linked List in Data Structures.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T22:45:19.000Z","updated_at":"2021-04-16T12:00:44.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1248,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":"","table_of_content":"","description":"$10","title":"Linear Queues in Data Structures","url_title":"linear-queues-in-data-structures","image_url":"","meta_title":"Introduction to Linear Queue in Data Structures","meta_desc":"Explore the basics of Linear Queue in Data Structures. Learn about the implementation and applications of this important data structure.","views":1324,"rating":4.1,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T18:31:27.000Z","updated_at":"2021-04-06T17:22:22.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":14},{"id":277,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":"","table_of_content":"","description":"$11","title":"Advanced Java Interview Questions","url_title":"advanced-java-interview-questions","image_url":"https://newtekslateassets.s3.us-west-2.amazonaws.com/wp-content/uploads/articles/advanced-java-Interview-questions-10032023.png","meta_title":"TOP 90+ Advanced JAVA Interview Questions (2023)","meta_desc":"Advanced JAVA Interview Questions and Answers? Ace your Advance JAVA interview with expert-curated, FAQ's and real-time case study questions and answers. ","views":5897,"rating":4.7,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-05-26T10:59:06.000Z","updated_at":"2021-04-03T13:21:27.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"What are java objects and java applications? ","faq_schema_a1":"Java object is an object that is provided by the execution of an application. When an application is compiled an object of that application is being made. Java application on the other hand is a program that is being written in Java and being read by the Java virtual machine.","faq_schema_q2":"Explain the different ways of using thread?","faq_schema_a2":"The thread could be implemented by using a runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritances. the only interface that can help.","faq_schema_q3":"What is synchronization and why is it important?","faq_schema_a3":"With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors.","like_counter":9},{"id":174,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":"","table_of_content":"","description":"$12","title":"Data Structures Interview Questions","url_title":"data-structures-interview-questions-answers","image_url":"","meta_title":"TOP 50+ Data Structures Interview Questions (2023)","meta_desc":"Data Structures Interview Questions and Answers - Tekslate experts compiled  Algorithm interview questions for freshers & experienced candidates to crack the interview","views":653,"rating":4.4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-02-19T11:18:52.000Z","updated_at":"2021-01-22T14:58:55.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":192,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":"","table_of_content":"","description":"$13","title":"Advanced Java Interview Questions & Answers","url_title":"advanced-java-interview-questions-answers","image_url":"","meta_title":"TOP 50 Advanced Java Interview Questions [2023]","meta_desc":"Looking for Advanced Java Interview Questions with Answers? Here we have compiled set of questions from the students who have attended interviews in Fortune 500 companies","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-02-23T04:52:31.000Z","updated_at":"2021-01-08T14:06:25.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":318,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$14","title":"Core Java Interview Questions","url_title":"core-java-interview-questions","image_url":"","meta_title":"TOP 50 Core Java Interview Questions [UPDATED] - TCS & Cognizant !!!","meta_desc":"Looking for Core Java Interview Questions with Answers? Here we have compiled set of questions from the students who have attended interviews in Fortune 500 companies","views":542,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-06-09T04:49:29.000Z","updated_at":"2020-10-27T14:25:51.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":2},{"id":1181,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":"","table_of_content":"","description":"$15","title":"History of MVC Architecture","url_title":"history-mvc-architecture","image_url":"","meta_title":"History of MVC Architecture | Tekslate","meta_desc":"History of MVC Architecture - in this tutorial learn about MVC architecture in detail. Learn  ASP.Net from Experts!","views":549,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-05T04:46:56.000Z","updated_at":"2020-10-17T12:21:17.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":2047,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$16","title":"Core Java Resume","url_title":"core-java-resume","image_url":"","meta_title":"Core Java Sample Resume","meta_desc":"We here share an Core Java developer Fresher and Experienced Sample Resume for Job Interview and also discuss on few Resume Writing Tips.","views":579,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2017-10-10T10:20:01.000Z","updated_at":"2020-10-05T18:09:10.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":103,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":"","table_of_content":"","description":"$17","title":"Core Java Tutorial","url_title":"core-java-tutorials","image_url":"","meta_title":"Learn Core Java Online With Examples | Core Java Tutorial","meta_desc":"Core Java tutorials gives enough knowledge to get up and run with real world application development and object-oriented programming using the Java Language","views":443,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-06-21T12:41:56.000Z","updated_at":"2020-09-26T17:23:14.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":41,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":"","table_of_content":"","description":"$18","title":"JSF Tutorial","url_title":"jsf-tutorials","image_url":"","meta_title":"JSF Tutorial | Java Server Faces Tutorial | JSF Basics","meta_desc":"JSF Tutorial teach you how to write ?custom JSF 2.2 themes ?custom factories ?handlers ?renderers ?components ?Enhance your applications with JSF.","views":3251,"rating":4.4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2015-01-01T08:55:52.000Z","updated_at":"2020-05-26T00:00:00.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":492,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$19","title":"Data Structures Interview Questions","url_title":"interview-questions-on-data-structures","image_url":"","meta_title":"TOP 50 Data Structures Interview Questions [UPDATED] !!!","meta_desc":"Looking for Data Structures Interview Questions with Answers? Here we have compiled set of questions from the students who have attended interviews in Fortune 500 companies","views":798,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-03-24T06:26:27.000Z","updated_at":"2020-03-30T00:00:00.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":1},{"id":93,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":"","table_of_content":"","description":"$1a","title":"Advanced Java Tutorial","url_title":"advanced-java-tutorials","image_url":"","meta_title":"Advanced Java Programming Tutorial | A Complete Guide to JAVA","meta_desc":"Advanced Java tutorial in Tekslate will help you to gain knowledge on advanced object oriented language to improve code maintenance and readability.","views":1088,"rating":4.3,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-06-15T05:12:57.000Z","updated_at":"2019-03-23T00:00:00.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":1249,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$1b","title":"Circular Queue in Data Structures","url_title":"circular-queue-in-data-structures","image_url":"","meta_title":"Circular Queue in Data Structures by Data Structures Expert","meta_desc":"In this tutorial, we will learn about what is Circular Queue in Data Structures and its implimentation.","views":948,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T18:33:25.000Z","updated_at":"2018-09-21T10:04:18.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1251,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$1c","title":"Linear search in Data Structures","url_title":"linear-search-in-data-structures","image_url":"","meta_title":"Linear search in Data Structures","meta_desc":"In this tutorial, we will learn about Linear search in Data Structures. The key which is to be searched, is compared with each element of the list one by on","views":607,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T20:54:04.000Z","updated_at":"2018-09-21T10:00:49.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1250,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$1d","title":"Postfix expression in Data Structures","url_title":"postfix-expression-in-data-structures","image_url":"","meta_title":"Postfix expression in Data Structures","meta_desc":"In this tutorial we will discuss about Postfix expression in Data Structures. Suppose p is an arithmetic expression written in postfix notation.","views":710,"rating":4.2,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T20:57:44.000Z","updated_at":"2018-09-21T10:00:31.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":1254,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$1e","title":"Selection sort in Data Structures","url_title":"selection-sort-in-data-structures","image_url":"","meta_title":"Selection sort in Data Structures","meta_desc":"In this tutorial we will learn about Selection sort in Data Structures. Suppose an array A with ‘n’ elements A[0],A[1],A[2]….. is in memory. The selection sort","views":1079,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T21:00:32.000Z","updated_at":"2018-09-21T10:00:10.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1255,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$1f","title":"Insertion sort in Data Structures","url_title":"insertion-sort-in-data-structures","image_url":"","meta_title":"Insertion sort in Data Structures","meta_desc":"In this tutorial, we will discuss about Insertion sort in Data Structures. Suppose an array ‘A’ with ‘n’ elements A[0]. A910,A[20],---------A[N-1] is in memory. The ins","views":963,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T21:32:42.000Z","updated_at":"2018-09-21T09:58:10.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1256,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$20","title":"Quick sort in Data Structures","url_title":"quick-sort-in-data-structures","image_url":"","meta_title":"Learn Quick sort in Data Structures From Experts","meta_desc":"In this tutorial, we will discuss about Quick Sort in Data Structures and Problem solving with Algorithms and Time Complexity.","views":488,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T21:35:04.000Z","updated_at":"2018-09-21T09:57:54.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1257,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$21","title":"Heap Sort in Data Structures","url_title":"heap-sort-in-data-structures","image_url":"","meta_title":"Learn Heap Sort in Data Structures From Experts ","meta_desc":"In this tutorial, we will discuss on sorting techniques based on Heap Data structures along with examples and algorithms.","views":441,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T21:40:07.000Z","updated_at":"2018-09-21T09:57:41.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1258,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$22","title":"Linked List in Data Structures","url_title":"linked-list-in-data-structures","image_url":"","meta_title":"Linked List in Data Structures","meta_desc":"In this tutorial, we will discuss about Linked List in Data Structures. The term “list” refers to a linear collection of data items. One way to store such","views":640,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T21:43:04.000Z","updated_at":"2018-09-21T09:57:23.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1262,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$23","title":"Queues using Linked list in Data Structures","url_title":"queues-using-linked-list-data-structures","image_url":"","meta_title":"Queues using Linked list in Data Structures","meta_desc":"In this tutorial, we will learn about Queues using Linked list in Data Structures. In configures storage (using arrays), queues where harder to manipulate","views":1064,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T22:47:03.000Z","updated_at":"2018-09-21T09:30:19.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1264,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$24","title":"Binary Trees in Data Structures","url_title":"binary-trees-in-data-structures","image_url":"","meta_title":"Binary Trees in Data Structures","meta_desc":"The objective of this tutorial is to understand Binary Trees in Data Structures. A binary tree T is defined as a finite set of elements, called nodes. T is","views":1077,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T22:51:39.000Z","updated_at":"2018-09-21T09:30:06.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1265,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$25","title":"Binary search tree in Data Structures","url_title":"binary-search-tree-in-data-structures","image_url":"","meta_title":"Binary search tree in Data Structures","meta_desc":"In this tutorial we will learn about Binary search tree in Data Structures. We will also look at few examples of binary search tree and understand their ada","views":287,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T22:53:26.000Z","updated_at":"2018-09-21T09:29:53.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1266,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$26","title":"AVL Trees in Data Structures","url_title":"avl-trees-in-data-structures","image_url":"","meta_title":"AVL Trees in Data Structures","meta_desc":"In this tutorial, we will gain knowledge on AVL Trees in Data Structures. We also discuss on algorithms and data structures in AVL Trees with examples.","views":1074,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T22:59:39.000Z","updated_at":"2018-09-21T09:29:39.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1259,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$27","title":"Circular linked list in Data Structures","url_title":"circular-linked-list-in-data-structures","image_url":"","meta_title":"Circular Linked List In Data Structures","meta_desc":"In this tutorial, we will learn about Circular linked list in Data Structures. A linked list in which the last node points to the first node instead of cont","views":787,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T23:03:38.000Z","updated_at":"2018-09-21T09:29:07.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1260,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$28","title":"Doubly Linked List in Data Structures","url_title":"doubly-linked-list-in-data-structures","image_url":"","meta_title":"Doubly Linked List in Data Structures","meta_desc":"In this tutorial, we will discuss about Doubly Linked List in Data Structures. In a single linked list, it is possible to move only in the direction of link","views":927,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-09T23:06:42.000Z","updated_at":"2018-09-21T09:18:36.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1267,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$29","title":"B Trees in Data Structures","url_title":"b-trees-in-data-structures","image_url":"","meta_title":"Study B Trees in Data Structures From Professionals","meta_desc":"In this tutorial, we will learn about B Trees in Data Structures. A B-tree is a self balancing tree that keeps data sorted and allows searches,Insertion,etc","views":452,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-10T18:34:53.000Z","updated_at":"2018-09-21T09:18:12.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1263,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$2a","title":"TREES in Data Structures","url_title":"trees-in-data-structures","image_url":"","meta_title":"TREES in Data Structures","meta_desc":"In this tutorial, we will discuss about TREES in Data Structures. A tree in data structures is a finite set of one or more nodes such that, 1.A distinguish","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-10T18:45:32.000Z","updated_at":"2018-09-21T09:17:59.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1268,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$2b","title":"Graphs in Data Structures","url_title":"graphs-in-data-structures","image_url":"","meta_title":"Learn Graphs in Data Structures designed by Experts","meta_desc":"In this tutorial, we will learn about Graphs in Data Structures. Graphs are a fundamental data structures in the world of Programming and more from examples","views":916,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2014-12-10T18:50:26.000Z","updated_at":"2018-09-21T09:17:39.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1727,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$2c","title":"JSF Elements","url_title":"jsf-elements","image_url":"","meta_title":"JSF Elements | TekSlate JFS Tutorials Online","meta_desc":"JSF Elements - In JSF Tutorials we will learn about JSF Elements,","views":638,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2015-01-06T23:27:37.000Z","updated_at":"2018-09-20T08:51:37.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":181,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$2d","title":"JSF Interview Questions & Answers","url_title":"jsf-interview-questions-answers","image_url":"","meta_title":"TOP 50 JSF Interview Questions [UPDATED] - TCS & Cognizant !!!","meta_desc":"Looking for JSF Interview Questions with Answers? Here we have compiled set of questions from the students who have attended interviews in Fortune 500 companies","views":615,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-02-22T05:29:48.000Z","updated_at":"2018-09-20T06:51:20.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1960,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$2e","title":"Java Virtual Machine","url_title":"java-virtual-machine-java","image_url":"","meta_title":"What is Java Virtual Machine (JVM) | Learn Java Online","meta_desc":"The Java platform is the concept of a \"virtual machine\" that executes Java bytecode programs.we will learn Java Virtual Machine in this tutorials.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-14T10:19:53.000Z","updated_at":"2018-09-17T10:44:57.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1961,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$2f","title":"Interface in Java","url_title":"java-interface-in-java","image_url":"","meta_title":"What is an Interface in Java? | Core Java-TekSlate","meta_desc":"In this tutorial we will learn about Interface in java. Interface is one of the core concept. Java Interface is core part of java programming language.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-15T05:27:30.000Z","updated_at":"2018-09-17T10:44:42.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1962,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$30","title":"Exception Handling in java","url_title":"exception-handling-in-java","image_url":"","meta_title":"What is Exception Handling in java? Java Tutorials with Examples","meta_desc":"In this tutorials, we will learn Exception Handling in Java with checked, unchecked and errors with example and usage of keywords.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-15T06:45:13.000Z","updated_at":"2018-09-17T10:44:28.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1963,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$31","title":"Multithreading in java","url_title":"java-multithreading-in-java","image_url":"","meta_title":"Multithreading in java| Learn Java Online - TekSlate","meta_desc":"In this tutorial we will learn about Multithreading in java. Multithreading in Java enables you to write in a way where multiple activities can proceed..","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-16T06:28:25.000Z","updated_at":"2018-09-17T10:18:55.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1967,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$32","title":"Polymorphism in Java","url_title":"polymorphism-in-java","image_url":"","meta_title":"Polymorphism in Java with Examples| Learn Java Online","meta_desc":"In this tutorial we will learn about Polymorphism in java. Polymorphism in Java showing different behaviors at different stages of its life cycle.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-16T08:22:23.000Z","updated_at":"2018-09-17T10:14:30.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1968,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$33","title":"Inheritance in Java","url_title":"java-inheritance-in-java","image_url":"","meta_title":"Inheritance in Java With Examples| Learn Java Online","meta_desc":"In this tutorials we will learn about Inheritance in Java with examples.Inheritance in Java refers to the ability in Java for one class to inherit from....","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-17T06:05:19.000Z","updated_at":"2018-09-17T10:13:51.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1969,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$34","title":"Constructors in Java","url_title":"java-constructors-in-java","image_url":"","meta_title":"What is Constructors in Java | Learn Java Tutorials Online","meta_desc":"In this tutorial, we will learn about Constructors in Java. Constructors in Java Initialize the class variables to default values.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-17T08:50:08.000Z","updated_at":"2018-09-17T10:13:31.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1970,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$35","title":"Java Annotations","url_title":"java-annotations-in-java","image_url":"","meta_title":"Java Annotations With Examples | Learn Java Online-TekSlate","meta_desc":"In this tutorial, we will discuss about Java Annotations. Java Annotations are a kind of meta-data, about elements of your code.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-19T08:25:26.000Z","updated_at":"2018-09-17T10:13:12.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1971,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$36","title":"Encapsulation in java","url_title":"java-encapsulation-in-java","image_url":"","meta_title":"Encapsulation in java | Learn Java Online -TekSlate","meta_desc":"In this tutorial we will learn Encapsulation in java. Encapsulation in javais a process of wrapping of data and methods in a single unit.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-19T08:49:15.000Z","updated_at":"2018-09-17T10:06:55.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1972,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$37","title":"Packages in java","url_title":"packages-in-java","image_url":"","meta_title":"Packages in java With Examples| How to create Packages in Java","meta_desc":"In this tutorial, we will learn Packages in java.Packages in java.Packages in Java is a mechanism to encapsulate a group of classes, interfaces and sub...","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-19T09:30:38.000Z","updated_at":"2018-09-17T10:06:39.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1973,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$38","title":"Java Regular Expressions","url_title":"java-regular-expressions-in-java","image_url":"","meta_title":"What are Java Regular Expressions| Learn Java Online-TekSlate","meta_desc":"In this tutorial we will discuss about Java Regular Expressions. Java Regular Expressions introduces the usage of regular expressions and implementation....","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-20T06:00:37.000Z","updated_at":"2018-09-17T10:06:15.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1974,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$39","title":"Arraylist in Java","url_title":"java-arraylist-in-java","image_url":"","meta_title":"What is the Arraylist in Java | Learn Java Tutorials With Examples","meta_desc":"In Java tutorials, we will learn about Arraylist in Java.Java ArrayList in java collections with add, example and Implementing the ArrayList in Java.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-20T07:03:21.000Z","updated_at":"2018-09-17T10:05:31.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":2008,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$3a","title":"Advanced Java Resume","url_title":"advanced-java-resume","image_url":"","meta_title":"Advanced Java Sample Resume","meta_desc":"We here share an Advanced JAVA Fresher and Experienced Sample Resume for Job Interview and also discuss on few Resume Writing Tips.","views":1006,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2017-09-23T08:34:45.000Z","updated_at":"2018-09-17T06:51:40.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1743,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$3b","title":"Event Handler Event handling in JSF","url_title":"event-handler-event-handling-jsf","image_url":"","meta_title":"Event Handler Event Handling In JSF","meta_desc":"In this tutorial, we will learn about types of event handler event handling in JSF","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:13:37.000Z","updated_at":"2018-09-17T05:19:47.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1744,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$3c","title":"Layouts in JSF- Tiles","url_title":"layouts-jsf-tiles","image_url":"","meta_title":"Layouts In JSF- Tiles","meta_desc":"In this tutorial, we will learn about what are the Layouts in JSF- Tiles and RICH Faces.","views":454,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:13:38.000Z","updated_at":"2018-09-17T05:19:35.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1742,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$3d","title":"Basic GUI Components in JSF","url_title":"basic-gui-components-jsf","image_url":"","meta_title":"Basic Gui Components In JSF","meta_desc":"In this tutorial, we will learn about what are the Basic GUI Components in JSF.","views":450,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:14:11.000Z","updated_at":"2018-09-17T05:19:15.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1741,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$3e","title":"CONVERTERS IN JSF","url_title":"converters-jsf","image_url":"","meta_title":"Converters In JSF","meta_desc":"In this tutorial, we will learn about what are the converters in JSF.","views":327,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:14:17.000Z","updated_at":"2018-09-17T05:18:50.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1740,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$3f","title":"Developing JSF2 Validations Application","url_title":"developing-jsf2-validations-application","image_url":"","meta_title":"Developing JSF2 Validations Application","meta_desc":"In this tutorial, we will learn about how to JSF2 Validations Application.","views":1021,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:17:13.000Z","updated_at":"2018-09-17T05:18:35.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1726,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$40","title":"FrameWorks in JSF","url_title":"frameworks-jsf","image_url":"","meta_title":"Frameworks In JSF","meta_desc":"In this tutorial, we will learn about what is Framework, Application of Framework in JSF","views":276,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:23:51.000Z","updated_at":"2018-09-17T05:14:31.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1728,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$41","title":"Creation and working with First Servlet in JSF","url_title":"creation-working-first-servlet-jsf","image_url":"","meta_title":"Creation And Working With First Servlet In JSF","meta_desc":"In this tutorial, we will learn about how to Create and working with Faces Servlet in JSF","views":282,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:23:58.000Z","updated_at":"2018-09-17T05:12:42.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1739,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$42","title":"JSF2 Validations Application","url_title":"jsf2-validations-application","image_url":"","meta_title":"JSF2 Validations Application","meta_desc":"In this tutorial, we will learn about JSF2 Validations Application","views":570,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:17:15.000Z","updated_at":"2018-09-17T05:12:19.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1737,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$43","title":"VALIDATIONS in JSF","url_title":"validations-jsf","image_url":"","meta_title":"Validations In JSF","meta_desc":"In this tutorial, we will learn about what are the Validations In JSF","views":187,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:17:31.000Z","updated_at":"2018-09-17T05:10:29.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1736,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$44","title":"steps to provide I18N Support in JSF Application","url_title":"steps-provide-i18n-support-jsf-application","image_url":"","meta_title":"Steps To Provide I18N Support In JSF Application","meta_desc":"In this tutorial, we will learn about what are steps to provide I18N Support in JSF Application","views":526,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:17:39.000Z","updated_at":"2018-09-17T05:09:53.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1735,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$45","title":"Developing I18N Applications in JSF","url_title":"developing-i18n-applications-jsf","image_url":"","meta_title":"Developing I18N Applications In JSF","meta_desc":"In this Developing I18N Applications In JSF tutorial, we will learn about How to make deploy I18N Applications in JSF","views":782,"rating":4.2,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:22:18.000Z","updated_at":"2018-09-17T05:09:11.000Z","status":1,"video_schema_name":"","video_schema_upload_date":"","video_schema_description":"","faq_schema_q1":"","faq_schema_a1":"","faq_schema_q2":"","faq_schema_a2":"","faq_schema_q3":"","faq_schema_a3":"","like_counter":0},{"id":1734,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$46","title":"Introduction to I18N Applications in JSF","url_title":"introduction-i18n-applications-jsf","image_url":"","meta_title":"Introduction To I18N Applications In JSF","meta_desc":"In this tutorial, we will learn about Introduction to I18N Applications in JSF and where I18N is Supported.","views":435,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:23:25.000Z","updated_at":"2018-09-17T05:06:44.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1733,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$47","title":"Steps to use Hyperlinks in JSF pages","url_title":"steps-use-hyperlinks-jsf-pages","image_url":"","meta_title":"Steps To Use Hyperlinks In JSF Pages","meta_desc":"In this tutorial, we will learn about what Steps to use Hyperlinks in JSF pages.","views":430,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:23:29.000Z","updated_at":"2018-09-17T05:05:42.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1725,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$48","title":"Enterprise Application in JSF","url_title":"enterprise-application-jsf","image_url":"","meta_title":"Enterprise Application In JSF","meta_desc":"In this tutorial, we will learn about what is Enterprise Application in JSF.","views":544,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:23:45.000Z","updated_at":"2018-09-17T05:04:15.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1724,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$49","title":"MVC Rules and Regulation in JSF","url_title":"mvc-rules-regulation-jsf","image_url":"","meta_title":"Mvc Rules And Regulation In JSF","meta_desc":"In this tutorial, we will learn about what are MVC Rules and Regulation in JSF.","views":122,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:25:36.000Z","updated_at":"2018-09-17T04:59:40.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1729,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$4a","title":"STEPS TO DESIGN FIRST APPLICATION in JSF","url_title":"steps-design-first-application-jsf","image_url":"","meta_title":"Steps To Design First Application In JSF","meta_desc":"In this tutorial, we will learn about what are the Steps To Design First Application In JSF.","views":387,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:25:41.000Z","updated_at":"2018-09-17T04:59:25.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1731,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$4b","title":"STEPS TO DESIGN JSF 1.2 APPLICATION IN ECLIPSE IDE","url_title":"steps-design-jsf-1-2-application-eclipse-ide","image_url":"","meta_title":"Steps To Design JSF 1.2 Application In Eclipse IDE","meta_desc":"In this tutorial, we will learn about how to Design JSF 1.2 Application In Eclipse IDE.","views":722,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:25:45.000Z","updated_at":"2018-09-17T04:58:55.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1730,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$4c","title":"Developing Registration Application in JSF","url_title":"developing-registration-application-jsf","image_url":"","meta_title":"Developing Registration Application In JSF","meta_desc":"In this tutorial, we will learn about how to develop on Registration Application in JSF","views":991,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:25:52.000Z","updated_at":"2018-09-17T04:54:46.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1732,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$4d","title":"DIFFERENCE BET N JSF1.X &JSF 2.X","url_title":"difference-bet-n-jsf1-x-jsf-2-x","image_url":"","meta_title":"Difference Bet N JSF1.X &JSF 2.X","meta_desc":"In this tutorial, we will learn about what are the differences between JSF1.X &JSF 2.X","views":539,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:25:48.000Z","updated_at":"2018-09-17T04:54:33.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":1723,"blog_category":174,"blog_type":3,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$4e","title":"Introduction to JSF","url_title":"introduction-jsf","image_url":"","meta_title":"Introduction To JSF","meta_desc":"In this tutorial, we will learn about what is JSF and its architecture.","views":979,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-01-09T09:25:56.000Z","updated_at":"2018-09-17T04:54:18.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":477,"blog_category":174,"blog_type":2,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"<h2><span style=\"color: #000000;\">JSF&nbsp;<strong>(JavaServer Faces)</strong>&nbsp;Interview Questions And&nbsp; Answers</span></h2>\n<p>&nbsp;</p>","title":"JSF Interview Questions And Answers","url_title":"jsf-interview-questions-and-answers","image_url":"","meta_title":"TOP 50 JSF Interview Questions [UPDATED] - TCS & Cognizant !!!","meta_desc":"Looking for JSF Interview Questions with Answers? Here we have compiled set of questions from the students who have attended interviews in Fortune 500 companies","views":946,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2018-03-15T06:28:36.000Z","updated_at":"2018-09-12T06:00:53.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0},{"id":150,"blog_category":174,"blog_type":1,"wp_id":1,"excerpt":null,"table_of_content":null,"description":"$4f","title":"JAVA Tutorials","url_title":"java-tutorials","image_url":"","meta_title":"Learn Java Tutorials Online With Examples | Learn Online","meta_desc":"Java tutorials gives enough knowledge to get up and run with real world application development and object-oriented programming using the Java Language.","views":0,"rating":4,"author":"1","top_level_cat_id":"4","author_desc":"","course_id":"2","created_at":"2016-12-14T06:47:26.000Z","updated_at":"2017-12-20T10:11:23.000Z","status":1,"video_schema_name":null,"video_schema_upload_date":null,"video_schema_description":null,"faq_schema_q1":null,"faq_schema_a1":null,"faq_schema_q2":null,"faq_schema_a2":null,"faq_schema_q3":null,"faq_schema_a3":null,"like_counter":0}],"type":"blog-cat","categories":[]},"urlName":"core-java"}]
a:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"core-java"}],["$","meta","3",{"name":"description","content":"TekSlate provides all the essential resources to help you become a skilled salesforce professional. Here is the list of informative resources that include tutorials, interview questions, and other technical blogs to make it easy for you to master core-java."}],["$","meta","4",{"name":"application-name","content":"tekslatetutor"}],["$","meta","5",{"name":"generator","content":"tekslatetutor"}],["$","link","6",{"rel":"canonical","href":"https://tekslate.com/core-java"}],["$","meta","7",{"property":"og:title","content":"core-java"}],["$","meta","8",{"property":"og:description","content":"TekSlate provides all the essential resources to help you become a skilled salesforce professional. Here is the list of informative resources that include tutorials, interview questions, and other technical blogs to make it easy for you to master core-java."}],["$","meta","9",{"property":"og:url","content":"https://tekslate.com/core-java"}],["$","meta","10",{"property":"og:site_name","content":"tekslatetutor"}],["$","meta","11",{"property":"og:locale","content":"en_US"}],["$","meta","12",{"property":"og:image","content":"https://tekslateassets.s3.amazonaws.com/images/TekSlate_New+Colour.svg"}],["$","meta","13",{"property":"og:image:width","content":"1200"}],["$","meta","14",{"property":"og:image:height","content":"628"}],["$","meta","15",{"property":"og:type","content":"website"}],["$","meta","16",{"name":"twitter:card","content":"summary"}],["$","meta","17",{"name":"twitter:creator","content":"@tekslatetutor"}],["$","meta","18",{"name":"twitter:title","content":"core-java"}],["$","meta","19",{"name":"twitter:description","content":"TekSlate provides all the essential resources to help you become a skilled salesforce professional. Here is the list of informative resources that include tutorials, interview questions, and other technical blogs to make it easy for you to master core-java."}],["$","meta","20",{"name":"twitter:image","content":"https://tekslateassets.s3.amazonaws.com/images/TekSlate_New+Colour.svg"}],["$","link","21",{"rel":"icon","href":"https://tekslateassets.s3.amazonaws.com/images/favicon.svg"}]]
1:null
