tag:blogger.com,1999:blog-36002928008237872692024-03-13T20:34:53.272-07:00SMARTWAY2STUDY/JAVAsmartwaytostudyhttp://www.blogger.com/profile/13242203493143145389noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-3600292800823787269.post-32028319789564009552016-11-18T01:28:00.004-08:002016-11-18T01:29:40.221-08:00 What is the difference between continue and break statement?<div>
<br /></div>
<div>
<br /></div>
<div>
Break and continue are two important keywords used in Loops. When a break keyword is used in a loop, loop is broken instantly while when continue keyword is used, current iteration is broken and loop continues with next iteration.</div>
<div>
<br /></div>
<div>
In below example, Loop is broken when counter reaches 4.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
for (counter=0;counter</div>
<div>
System.out.println(counter);</div>
<div>
</div>
<div>
if (counter==4) {</div>
<div>
</div>
<div>
break;}</div>
<div>
</div>
<div>
}</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
In the below example when counter reaches 4, loop jumps tonext iteration and any statements after the continue keyword are skipped for current iteration.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
for (counter=0;counter</div>
<div>
System.out.println(counter);</div>
<div>
</div>
<div>
if (counter==4) {</div>
<div>
</div>
<div>
continue;</div>
<div>
</div>
<div>
}</div>
<div>
</div>
<div>
System.outprintln("This will not get printed when counter is 4");</div>
<div>
</div>
<div>
}</div>
<div>
Java</div>
<div>
<br /></div>
<div>
1</div>
<div>
<br /></div>
<div>
for (counter=0;counter</div>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-24982285497069427092016-11-18T01:25:00.002-08:002016-11-18T01:25:58.763-08:00What is a singleton class? Give a practical example of its usage.<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
A singleton class in java can have only one instance and hence all its methods and variables belong to just one instance. Singleton class concept is useful for the situations when there is a need to limit the number of objects for a class.</div>
<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
The best example of singleton usage scenario is when there is a limit of having only one connection to a database due to some driver limitations or because of any licensing issues.</div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-926958036318474042016-11-18T01:24:00.003-08:002016-11-18T01:24:55.536-08:00What’s the purpose of Static methods and static variables?<span style="background-color: white; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px;">When there is a requirement to share a method or a variable between multiple objects of a class instead of creating separate copies for each object, we use static keyword to make a method or variable shared for all objects.</span>Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-41598737353753892962016-11-18T01:23:00.005-08:002016-11-18T01:23:42.494-08:00What are the various access specifiers for Java classes?<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
1. Public : Class,Method,Field is accessible from anywhere.</div>
<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
2. Protected:Method,Field can be accessed from the same class to which they belong or from the sub-classes,and from the class of same package,but not from outside.</div>
<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
3. Default: Method,Field,class can be accessed only from the same package and not from outside of it’s native package.</div>
<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
4. Private: Method,Field can be accessed from the same class to which they belong.</div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-68533729170062599912016-11-18T01:23:00.002-08:002016-11-18T01:23:09.077-08:00 What is the difference between an Inner Class and a Sub-Class?<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
An Inner class is a class which is nested within another class. An Inner class has access rights for the class which is nesting it and it can access all variables and methods defined in the outer class.</div>
<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
<span id="more-39" style="border: 0px rgb(225, 225, 225); box-sizing: border-box; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"></span></div>
<div style="background-color: white; border: 0px rgb(225, 225, 225); box-sizing: border-box; color: #666666; font-family: "Open Sans", HelveticaNeue, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 0.85em; margin-top: 0.85em; padding: 0px; vertical-align: baseline;">
A sub-class is a class which inherits from another class called super class. Sub-class can access all public and protected methods and fields of its super class.</div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-49583515902642049192016-11-18T01:20:00.004-08:002016-11-18T01:20:44.222-08:00What is the difference between throw and throws ?<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">The throw keyword is used to explicitly raise a exception within the program.</span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">The throws clause is used to indicate those exceptions that are not handled by a method.</span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">Each method must explicitly specify which exceptions does not handle, so the callers of that method can guard against possible exceptions. </span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">Finally, multiple exceptions are separated by a comma.</span>Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-12782352133861037082016-11-18T01:18:00.004-08:002016-11-18T01:18:42.243-08:00What is the difference between HashSet and TreeSet ?<br />
<ul>
<li>The <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashSet</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> is Implemented using a hash table.</span></li>
<li>Its elements are not ordered. </li>
<li>The add, remove, and contains methods of a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashSet</a>.</code></li>
<li><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">Time</span><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> </span><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">complexity O(1). </span></li>
</ul>
<br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<br />
<ul>
<li> <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">TreeSet</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> is implemented using a tree structure. </span></li>
<li>The elements in a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">TreeSet</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> are sorted.</span></li>
<li>The add, remove, and contains methods.</li>
<li>Time complexity O(logn).</li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-42107612368363574382016-11-18T01:15:00.004-08:002016-11-18T01:15:34.552-08:00 What is Comparable and Comparator interface ? List their differences.<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">Java provides the </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Comparable</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">interface, --> which contains only one method, called </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html#compareTo(T)" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">compareTo</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">. </span><br />
<br />
<ol>
<li>This method compares two objects, in order to impose an order between them. Specifically, it returns a negative integer, zero, or a positive integer to indicate that the input object is less than, equal or greater than the existing object. </li>
</ol>
<br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">Java provides the </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Comparator</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> interface, --> which contains two methods, called </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html#compare(T,%20T)" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">compare</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> and </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html#equals(java.lang.Object)" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">equals</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">. </span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<br />
<ol>
<li>The first method compares its two input arguments and imposes an order between them. It returns a negative integer, zero, or a positive integer to indicate that the first argument is less than, equal to, or greater than the second. </li>
<li>The second method requires an object as a parameter and aims to decide whether the input object is equal to the comparator. The method returns true, only if the specified object is also a comparator and it imposes the same ordering as the comparator.</li>
</ol>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-31229131053664178732016-11-18T01:09:00.001-08:002016-11-18T01:12:41.455-08:00What is difference between ArrayList and LinkedList ? <br />
1) ArrayList internally uses dynamic array to store the elements.<br />
LinkedList internally uses doubly linked list to store the elements.<br />
<br />
2) Manipulation with ArrayList is slow because it internally uses array. If any element is removed from the array, all the bits are shifted in memory.<br />
Manipulation with LinkedList is faster than ArrayList because it uses doubly linked list so no bit shifting is required in memory.<br />
<br />
3) ArrayList class can act as a list only because it implements List only.<br />
LinkedList class can act as a list and queue both because it implements List and Deque interfaces.<br />
<br />
<br />
4) ArrayList is better for storing and accessing data.<br />
LinkedList is better for manipulating data.Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-21786557755985250682016-11-18T01:04:00.002-08:002016-11-18T01:06:55.052-08:00What is difference between Array and ArrayList ? When will you use Array over ArrayList ?<ul style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px 0px 25px 10px; outline: none; padding: 0px;">
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Arrays</a></code> can contain primitive or objects, while an <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">ArrayList</a></code> can contain only objects.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Arrays</a></code> have fixed size, while an <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">ArrayList</a></code> is dynamic.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">An <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">ArrayList</a></code>provides more methods and features, such as <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#addAll(java.util.Collection)" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">addAll</a></code>, <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#removeAll(java.util.Collection)" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">removeAll</a></code>, <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#iterator()" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">iterator</a></code>, etc.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">For a list of primitive data types, the collections use autoboxing to reduce the coding effort. However, this approach makes them slower when working on fixed size primitive data types.</li>
</ul>
<div>
<span style="color: #333333; font-family: tahoma, arial, verdana, sans-serif;"><span style="font-size: 15px;"><br /></span></span></div>
<div>
<table border="1" style="background-color: white; border-collapse: collapse; border-spacing: 0px; box-sizing: border-box; color: #333333; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 13px; max-width: 100%;"><tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
<span style="box-sizing: border-box; font-weight: 700;">Array</span></div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
<span style="box-sizing: border-box; font-weight: 700;">ArrayList</span></div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Arrays are data structures that can store elements of similar data type.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList is a collection that can store elements of similar data type as well as elements of different data type.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Along with objects, Arrays can also store elements of primitive data type.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList cannot store elements of primitive data type. ArrayList can store only objects.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Array size is fixed.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList is resizable. Its size is not fixed.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
While declaring and creating the Array, the size is specified in square brackets []. For example,</div>
<div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
int[] intArray = new int[10]</div>
<div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
The above statement creates an integer array of size 10. After creating it, its size cannot be changed. It cannot hold more than 10 elements.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList has a special parameter called initialCapacity using which the initial size of the ArrayList is specified. Later on, the ArrayList can be resized.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Array cannot automatically grow or shrink in size.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList has the capability to automatically grow and shrink in size. When an element is removed from the ArrayList, its size is reduced by 1. When an element is added to the ArrayList and if its initial capacity is reached then the size is automatically increased by 1.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Array is not part of collection framework. Arrays are directly defined in java language as a basic data structure.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList is part of Collection framework.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Arrays inherit from java.lang.Object.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList implements List interface and inherits AbstractList class.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Generics cannot be used along with Arrays.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
When elements of similar data type have to be stored in an ArrayList then the ArrayList will use generics.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Arrays can be single dimensional or multi dimensional.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList can only be single dimensional.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Arrays are present in java.lang package. However a customized array class is present in java.util package. This java.util.Arrays has the capability to perform binary search, copy of another array, fill, sort and much more using its predefined methods.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList is present in java.util package. ArrayList also has rich predefined methods such as add, addAll, remove, toArray, iterator, listiterator, sort, reverse and much more.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Arrays can be iterated through a simple for loop by iterating over its index.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList can be iterated using Iterator or ListIterator.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Arrays cannot be synchronized.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList can be synchronized.</div>
</td></tr>
<tr style="box-sizing: border-box;"><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
Array elements are accessed using its index. The index ranges from 0 to array length-1.</div>
</td><td style="box-sizing: border-box; padding: 0px;"><div style="box-sizing: border-box; color: #444444; margin-bottom: 10px;">
ArrayList elements are accessed using get() and other specialized methods.</div>
</td></tr>
</tbody></table>
</div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-15133534993929962292016-11-18T01:03:00.001-08:002016-11-18T01:03:35.843-08:00What differences exist between HashMap and Hashtable ?<div>
<div>
<br /></div>
</div>
<ol><ol>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">A <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code> allows the existence of null keys and values, </li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Hashtable</a></code> doesn’t allow neither null keys, nor null values.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><br /></li>
</ol>
<ol>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">A <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Hashtable</a></code> is synchronized.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">while a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code> is not.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><br /></li>
</ol>
<ol>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"> <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code> is preferred in single-threaded environments.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"> <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Hashtable</a></code> is suitable for multi-threaded environments.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><br /></li>
</ol>
<ol>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">A <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code> provides its set of keys and a Java application can iterate over them.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Hashtable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Hashtable</a></code> provides an <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Enumeration.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Enumeration</a></code> of its keys.</li>
</ol>
</ol>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-47180880241669869442016-11-18T00:58:00.004-08:002016-11-18T00:58:59.446-08:00What is the importance of hashCode() and equals() methods ?<br />
<ul>
<li>In Java, a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> uses the </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode%28%29" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">hashCode</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> and </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals%28java.lang.Object%29" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">equals</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> methods to determine the index of the key-value pair and to detect duplicates.</span></li>
<li>More specifically, the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode%28%29" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">hashCode</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">method is used in order to determine where the specified key will be stored. </span></li>
<li>Since different keys may produce the same hash value, the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals%28java.lang.Object%29" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">equals</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> method is used, in order to determine whether the specified key actually exists in the collection or not.</span></li>
<li>Therefore, the implementation of both methods is crucial to the accuracy and efficiency of the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">.</span></li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-49771894090576069402016-11-18T00:57:00.001-08:002016-11-18T00:57:10.503-08:00How HashMap works in Java ? <br />
<ul>
<li>The <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> requires a hash function and uses </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode%28%29" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">hashCode</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> and equals methods, </span><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">in order to put and retrieve elements to and from the collection respectively. </span></li>
<li>When the put method is invoked, the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> calculates the hash value of the key and stores the pair in the appropriate index inside the collection. </span></li>
<li>If the key exists, its value is updated with the new value. </li>
<li>Some important characteristics of a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">HashMap</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"> are its capacity, its load factor and the threshold resizing.</span></li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-76738067240134333362016-11-18T00:53:00.003-08:002016-11-18T00:53:53.126-08:00Java Collections<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; outline: none; padding: 0px 0px 1em;">
<code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/technotes/guides/collections/overview.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Java Collections Framework</a></code> provides a well designed set of interfaces and classes that support operations on a collections of objects. The most basic interfaces that reside in the Java Collections Framework are:</div>
<ul style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px 0px 25px 10px; outline: none; padding: 0px;">
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Collection</a></code>, which represents a group of objects known as its elements.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Set.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Set</a></code>, which is a collection that cannot contain duplicate elements.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">List</a></code>, which is an ordered collection and can contain duplicate elements.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/Map.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Map</a></code>, which is an object that maps keys to values and cannot contain duplicate keys.</li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-26109918512114007252016-11-18T00:51:00.001-08:002016-11-18T00:51:27.137-08:00What is the difference between a synchronized method and a synchronized block ?<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">In Java programming, each object has a lock. </span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">A thread can acquire the lock for an object by using the synchronized keyword. </span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">The synchronized keyword can be applied in a method level or block level of code.</span>Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-65925724203132674262016-11-18T00:49:00.000-08:002016-11-18T00:49:49.002-08:00Explain the available thread states in a high-level.<ul style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px 0px 25px 10px; outline: none; padding: 0px;">
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><strong style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.State.html#NEW" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">NEW</a></strong></code>: The thread becomes ready to run, but does not necessarily start running immediately.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><strong style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.State.html#RUNNABLE" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">RUNNABLE</a></strong></code>: The Java Virtual Machine (JVM) is actively executing the thread’s code.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><strong style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.State.html#BLOCKED" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">BLOCKED</a></strong></code>: The thread is in a blocked state while waiting for a monitor lock.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><strong style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.State.html#WAITING" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">WAITING</a></strong></code>: The thread waits for another thread to perform a particular action.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><strong style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.State.html#TIMED_WAITING" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">TIMED_WAITING</a></strong></code>: The thread waits for another thread to perform a particular action up to a specified waiting time.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;"><code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><strong style="border: 0px none; list-style: none; margin: 0px; outline: none; padding: 0px;"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.State.html#TERMINATED" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">TERMINATED</a></strong></code>: The thread has finished its execution.</li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-35538722447443395702016-11-18T00:47:00.003-08:002016-11-18T00:47:55.569-08:00Explain different ways of creating a thread. Which one would you prefer and why ? <div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; outline: none; padding: 0px 0px 1em;">
There are three ways that can be used in order for a <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Thread</a></code> to be created:</div>
<ul style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px 0px 25px 10px; outline: none; padding: 0px;">
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">A class may extend the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Thread</a></code> class.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">A class may implement the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runnable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Runnable</a></code> interface.</li>
<li style="border: 0px none; list-style: disc outside none; margin: 0px 0px 5px 10px; outline: none; padding: 0px;">An application can use the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executor.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Executor</a></code> framework, in order to create a thread pool.</li>
</ul>
<div style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; outline: none; padding: 0px 0px 1em;">
The <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runnable.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Runnable</a></code> interface is preferred, as it does not require an object to inherit the <code style="background: url("/wp-content/themes/jarida/images/code-bg.png"); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Thread</a></code> class. </div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-822348233771174012016-11-18T00:45:00.002-08:002016-11-18T00:45:46.881-08:00What is the difference between an Interface and an Abstract class ? <strong style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px; outline: none; padding: 0px;">Interface v/s </strong><strong style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px; outline: none; padding: 0px;">Abstract class</strong><br />
<strong style="background-color: white; border: 0px none; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px; list-style: none; margin: 0px; outline: none; padding: 0px;"><br /></strong>
<br />
<ul>
<li><span style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="font-size: 15px;"><b>All methods in an interface are implicitly abstract</b></span></span></li>
<li><span style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="font-size: 15px;"><b>Abstract class may contain both abstract and non-abstract methods.</b></span></span></li>
</ul>
<div>
<span style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="font-size: 15px;"><b><br /></b></span></span></div>
<ul>
<li>A class may implement a number of Interfaces</li>
<li><b style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">Abstract class </b>can extend only one abstract class</li>
</ul>
<div>
<br /></div>
<div>
</div>
<br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><ul>
<li>In order for a class to implement an interface, it must implement all its declared methods. However, a class may not implement all declared methods of an abstract class. Though, in this case, the sub-class must also be declared as abstract.</li>
<li>Abstract classes can implement interfaces without even providing the implementation of interface methods.</li>
</ul>
</span><ul style="background-color: white; border: 0px none; list-style: none; margin: 0px 0px 25px 10px; outline: none; padding: 0px;">
<li><span style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="font-size: 15px;"><br /></span></span></li>
</ul>
<span style="background-color: white;"><ul>
<li>Variables declared in a Java interface is by default final.</li>
</ul>
</span><ul>
<li>An abstract class may contain non-final variables.</li>
</ul>
<div>
<br /></div>
<ul>
<li>Members of a Java interface are public by default.</li>
<li>A member of an abstract class can either be private, protected or public.</li>
</ul>
<div>
<br /></div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-49712883502093135342016-11-18T00:36:00.002-08:002016-11-18T00:36:44.496-08:00Does Java support multiple inheritance ?<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">No, Java does not support multiple inheritance. Each class is able to extend only on one class, but is able to implement more than one interfaces.</span>Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-33912497659799319902016-11-18T00:34:00.002-08:002016-11-18T00:34:54.994-08:00Can you access non static variable in static context ? <br />
<ul>
<li>A static variable in Java belongs to its class and its value remains the same for all its instances.</li>
<li>A static variable is initialized when the class is loaded by the JVM.</li>
<li>If your code tries to access a non-static variable, without any instance, the compiler will complain, because those variables are not created yet and they are not associated with any instance.</li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-51764299721030799352016-11-18T00:32:00.001-08:002016-11-18T00:32:08.531-08:00What does the “static” keyword mean ? Can you override private or static method in Java ?<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">The static keyword denotes that a member variable or method can be accessed, without requiring an instantiation of the class.</span><br />
<span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;"><br /></span>
<br />
<ul>
<li>User cannot override <span style="color: #326693; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="background-color: white; border-color: initial; border-image: initial; font-size: 15px; list-style: none; outline-color: initial; outline-width: initial; transition: all 0.2s ease-in-out;">static methods in Java</span></span><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">, </span>because method overriding is based upon dynamic binding at run time.</li>
<li>Static methods are statically binded at compile time</li>
<li>A static method is not associated with any instance of a class so the concept is not applicable.</li>
</ul>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-52929529803662366072016-11-18T00:28:00.001-08:002016-11-18T00:28:01.628-08:00 What is the Difference between JDK and JRE ?<br />
<ul>
<li>The Java Runtime Environment (JRE) is</li>
<ul>
<li> <b>B</b>asically the Java Virtual Machine (JVM) </li>
<li>Where your Java programs are being executed. </li>
<li>It also includes browser plugins for applet execution. </li>
</ul>
<li>The Java Development Kit (JDK) is </li>
<ul>
<li>The full featured Software Development Kit for Java, including the JRE, the compilers and tools (like <code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">JavaDoc</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">, and </span><code style="background: url("/wp-content/themes/jarida/images/code-bg.png") rgb(255, 255, 255); border-color: rgb(225, 225, 225) rgb(240, 240, 240) rgb(240, 240, 240) rgb(225, 225, 225); border-image: initial; border-style: solid; border-width: 1px; color: #666666; direction: ltr; display: inline; font-family: "andale mono", "lucida console", monospace; font-size: 11px; font-stretch: normal; line-height: 19px; list-style: none; margin: 0px 0px 20px; outline: none; overflow-x: visible; overflow-y: hidden; padding: 3px;"><a href="http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html" style="border: 0px none; color: #326693; list-style: none; margin: 0px; outline: none; padding: 0px; text-decoration: none; transition: all 0.2s ease-in-out;">Java Debugger</a></code><span style="background-color: white; color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 15px;">), in order for a user to develop, compile and execute Java applications.</span></li>
</ul>
</ul>
<div>
<span style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="font-size: 15px;"><br /></span></span></div>
<div>
<span style="color: #333333; font-family: Tahoma, Arial, Verdana, sans-serif;"><span style="font-size: 15px;"><br /></span></span></div>
Anonymoushttp://www.blogger.com/profile/07313478157495577143noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-22737294170191757472016-04-12T06:07:00.002-07:002016-04-12T06:07:58.258-07:00Java questions - part 10<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">1. How many objects are created in the following piece of code?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">My class C1, C2, C3;</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">C1 = new Myclass ();</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">C2 = new Myclass ();</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Only 2 objects are created, C1 and C3. The reference C2 is only declared and not initialized.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">2. Can a public class</span><span style="font-family: "georgia"; font-size: 13.5pt;"><span style="color: blue;"> '</span></span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;">Myclass</span><span style="font-family: "georgia"; font-size: 13.5pt;"><span style="color: blue;">'</span></span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;"> be defined in a source file named </span><span style="font-family: "georgia"; font-size: 13.5pt;"><span style="color: blue;">'</span></span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;">Yourclass.java</span><span style="font-family: "georgia"; font-size: 13.5pt;"><span style="color: blue;">'</span></span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;">?</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="text-align: justify;"><span style="font-family: "georgia";"><span style="font-size: 18px;">The source file name, if it contains a public class, must be the same as the public name itself with a .java extension.</span></span></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="text-align: justify;"><span style="font-family: "georgia";"><span style="font-size: 18px;"><br /></span></span></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">3. Can main() method be declared final?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Yes, the main() method can be declared final, in addition to being public static.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">4. What is HashMap and Map?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Map is an interface and Hashmap is the class that implements Map.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">5. Difference between HashMap and HashTable?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">The HashMap class is roughly equivalent to HashTable, except that it is unsynchronised and permits nulls. (HashMap allows null values as key and value whereas HashTable doesnot allow).</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"> HashMap does not guarantee that the order of the Map will remain constant over time. HashMap is unsynchronised and HashTable is synchronised.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">6. Difference between Vector and ArrayList?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Vector is synchronised whereas ArrayList is not.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">7. Difference between Swing and Awt?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Awt are heavy-weight components. Swings are light-weight components. Hence Swing works faster than Awt.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">8. What will be the default values of all the elements of an array defined as an instance variable?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: green; font-family: "georgia"; font-size: 18px; text-align: justify;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">If the array is an array of primitive types, then all the elements of the array will be initialised to the default value corresponding to that primitive type. Example: All the elements of an array of Int will be initialised to <span style="background-color: white;"><span style="color: orange;">0</span></span> (zero), while that of booleab type will be initialised to false. Whereas if the array is an array of reference (of any type), all the elements will be initialised to null.</span><span style="font-family: "georgia"; font-size: 13.5pt;"> </span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; mso-list: l0 level1 lfo1;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><o:p></o:p></span></div>
</div>
smartwaytostudyhttp://www.blogger.com/profile/13242203493143145389noreply@blogger.com0tag:blogger.com,1999:blog-3600292800823787269.post-27215639237236414122016-03-31T00:36:00.000-07:002016-04-12T06:01:32.001-07:00SDLC INTERVIEW QUESTIONS--1<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">1. What is SDLC?</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 13.5pt;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">The various activities which are undertaken when developing software are commonly modelled as a software development life cycle.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;">The software development life cycle begins with the identification of a requirement for software and ends with the format verification of the developed software against that requirement.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">2. what is the " software life cycle"?</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">The life cycle begins when an application is first concieved and ends when it is no longer in use.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">3. Is it necessary to use SDLC for software development?</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Because software can be very difficult and complex. Without SDLC you may end up producing low quality product, you may take more time to complete the project against the actual time to deliver the product, you may go over budget. SDLC provides well-defined, disciplined, efficient, approach in solving business and information technology problems. You can also calculate budget, and appropriate time to deliver the product.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;">It provides control/monitor over the process of application development, what all steps to be followed, defines and focus on roles and responsibilities provides a predefined level of precision to facilitate a complete, correct and predictable solution, enforces planning and control.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">4. Different phases of SDLC.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia";"><span style="font-size: 13.5pt;">Requirement, Analysis, Designing, coding and unit testing, testingk, UAT, </span><span style="font-size: 18px;">maintenance</span><span style="font-size: 13.5pt;">.</span></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia";"><span style="font-size: 13.5pt;"><br /></span></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">5. Requirement Phase</span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;"></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">By Interacting with the customer, we establish the service that the customer requires from a system and the constraints under which it operate are developed. How the system should react to particular inputs and how the system should behave in a particular situation. Definition of the function or entity. Description of inputs and where they come from. Descriptions of outputs and where they go to, Inter dependency of the functions. Pre and post conditions. The side effects (if any) of the function. Business Analist (BA)/Domain Expert - usually MBA with atleast 8-10 years of domain specific experience who will understand the requirement or the business needs of the organisations. Specific what type of a project it is, whether it is a complete new project, or to rewrite the existing systems, or it is Maintenance project. Defines the type of the task the system should do. What type of SDLC to follow.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia";"><span style="font-size: 13.5pt;">6. Who is </span><span style="font-size: 18px;">Business</span><span style="font-size: 13.5pt;"> Analyst?</span></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">He is the one who collects the data from the stake holder, where in the raw requirements are processed into functional objectivers. The documentation of the requirement is done or a use can document, a prototype is developed, He uses some data flow diagrams to establish the requirement specification. Because just by natural langusre the developer doesn't understand the actual requirements and may not be able to develop the product. Estimation of the project is done.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">7. Analysis phase</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia";"><span style="font-size: 13.5pt;">In this phase decisions on a technology for software development based on several </span><span style="font-size: 18px;">factors</span><span style="font-size: 13.5pt;"> --- Cost, existing licences on software, licencing cost, scalability of the application, etc., out come of this phase is technology and software, Software Architecture Document (SAD) SAD is prepared by Architect - BE/MTech/MCA with atleast 15+ experience, will be having high level knowledge on all the technology for eg. COM, DCOM in .NET, Springs, hibernate in J2EE, ABAP in SAP, etc.,</span></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia";"><span style="font-size: 13.5pt;"><br /></span></span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">8. Software Architecture Document</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">SAD is not a design document. It sets some specifications like how it should be done. It provides some means of tracability between the requirements and the final system design to be implemented. The purpose of the SAD is provide</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ol style="text-align: left;">
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">An outline description of the software Architecture, including major software components and their interactions.</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">A common understanding of the architectural principles used during design and implementation.</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">A description of the hardware and software platforms on which the system is built and deployed.</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">Explicit justification of how the architecture meets the non-functional requirements.</span></li>
</ol>
<div style="text-align: justify;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">9. Design phase</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">High level design: Designers (BE/MTech/MCA) with 10+ years experience in a particular technology.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ul style="text-align: left;">
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">First they describe what the system is (whether it is a distributed or client-server etc.,)</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">What platforms the system will run on .....</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">The major inputs and output</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">What uses interfaces the system will have and in what form (Web, Windows GUI, etc.,)</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">High level design/software architecture document is given to the client, framework, database schema of the application is described.</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">Design patterns are established.</span></li>
</ul>
<div style="text-align: justify;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;">Low level design :-- Designers (BE/MTech/MCA) with 10+ years of experience in a particular technology.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ul style="text-align: left;">
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">Class diagram and Sequence diagram</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">Low level design document containing class diagram sequence diagrams given to the developers.</span></li>
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">DB is designed, cvs is configured and base version is put into it.</span></li>
</ul>
<div>
</div>
<div style="text-align: justify;">
<br /></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">10. What is project planning?</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
<div style="text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Project planning defines in detail the project activities and the product that will be produced, and describes how the project activities will be accomplished. Project planning defines all major tasks, estimates the size of the project, the scope of the effort, the resources required to complete the project, if any new technology is required and those technical experts are not their then you got appoint them, as well as steps to produce a project schedule, identify, assess and manage risks and negotiate commitments.</span></div>
</div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt;">
</div>
<ul style="text-align: left;">
<li style="text-align: justify;"><span style="font-family: "georgia"; font-size: 13.5pt;">Risks is probability that some adverse circumstances will occur ........ risks like risks that affect the schedule or resources are not available.</span></li>
</ul>
<div>
<span style="font-family: "georgia";"><span style="font-size: 18px;"></span></span><br />
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">11. Implementation (coding and unit testing)</span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;"></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">A team with TL, CL are appointed who do the coding part to develop the software ....... *developers (BE/MTech/MCA) with 0-6 years of experience come into picture .....................</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">12. How do you assign tasks to the team</span><span style="color: red; font-family: "georgia"; font-size: 13.5pt;"></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">First of all you got to know the technical ability of a programmer, for this purpose you got to do is ask some general technical questions or assign some task depending on the technology. By doing so you come to know their technical ability and then accordingly you can divide the tasks among the team.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">13. Why customer developer partnership is important</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">The success of any product depends on the customer satisfaction and remarks. Customer is constantly involved from the start of the project till delivery of the product he has to be kept informed about the progress of the project. When ever you develop and module you got to cross verify with the customer whether it meets the business goals.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">14. What are the roles of TL and CL?</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">TL is concerned with getting the work done on scheduled time, motivate the team members, conduct meetings with the team members, hr maintains an excel sheet of the project progress states, if any project member faces any problems he has to give solutions to them...........</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;">CL would first create cvs repository and corresponding login, would check in the base version. He has to take care that check in is conducted properly on a daily basis. Once check in is done he would take a fresh check out and would take build of it and if any error found then on which module and who has done it, would ask him to correct it and once every thing is fine then next day everybody can check out blindly.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">15. How were the issues being handled</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">If there is any issue that needs to be taken care of then you mention it in a excel sheet, the TL would conduct a meeting and get the issue resolved depending on the type of a issue whether it is a db related or prototype or technical, correspondingly the meeting is conducted and get the issue resolved.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">16. What is code review</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Once the module or coding is completed you perform a code review the reviewer would check the module whether documentation is done or not if any errors in a program, if exception handling is not then would specify the status as fatal in excel sheet and so on.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">17. Testing phase</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">A testing team would conduct number of testing on the application. In generally the types of testings are </span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: #336699; font-family: "georgia"; font-size: 13.5pt; text-align: left;">Defect testing :- </span><span style="font-family: "georgia"; font-size: 13.5pt;">To discover faults or defects in the software where its behavior is incorrect or not in sync with specification.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: #ff0066; font-family: "georgia"; font-size: 13.5pt; text-align: left;">Component testing :- </span><span style="font-family: "georgia"; font-size: 13.5pt;">In the module wise testing test cases are written for the module and run against module. Choose inputs that force the system to generate all error messages. Design inputs that cause buffer to overflow and so on.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-size: 18px; text-align: left;"><span style="color: green; font-family: "georgia";">Performance</span></span><span style="color: green; font-family: "georgia"; font-size: 13.5pt; text-align: left;"> and reliability test :- </span><span style="font-family: "georgia"; font-size: 13.5pt;">A series of tests are done where in the load is steadily increased until the system performance becomes unacceptable.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: magenta; font-family: "georgia"; font-size: 13.5pt; text-align: left;">Stress testing :-</span><span style="font-family: "georgia"; font-size: 13.5pt;"> In the sense system should not fail catastrophically, loss of series of data.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: #009999; font-family: "georgia"; font-size: 13.5pt; text-align: left;">Black box testing :-</span><span style="font-family: "georgia"; font-size: 13.5pt;"> Its also said as release test or functionality test. Testing to find defects int he system, first for such and such a input this should be the output, for invalid inputs this should be the output and so on.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: red; font-family: "georgia"; font-size: 13.5pt;">18. User Acceptance testing:-</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="color: green; font-family: "georgia"; font-size: 18px;">Exp: </span><span style="font-family: "georgia"; font-size: 13.5pt;">Client performs the test before accepting the product.</span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-family: "georgia"; font-size: 13.5pt;"><br /></span></div>
<div class="p0" style="margin-bottom: 0pt; margin-top: 0pt; text-align: justify;">
<span style="font-size: 16pt; letter-spacing: 0pt;">E-Mail : </span><span style="font-size: 16pt; letter-spacing: 0pt;">shanth73@gmail.com</span><span style="font-family: "georgia"; font-size: 16pt;"><o:p></o:p></span></div>
</div>
</div>
</div>
smartwaytostudyhttp://www.blogger.com/profile/13242203493143145389noreply@blogger.com0