<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5546221036099219477</atom:id><lastBuildDate>Sat, 14 Sep 2024 23:47:41 +0000</lastBuildDate><category>Basics</category><category>Introduction</category><title>Java Programs</title><description>A Useful site for the java Learners where they will find basic tools for learning Java....</description><link>http://rapidjava.blogspot.com/</link><managingEditor>noreply@blogger.com (Vignesh)</managingEditor><generator>Blogger</generator><openSearch:totalResults>29</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle>A Useful site for the java Learners where they will find basic tools for learning Java....</itunes:subtitle><itunes:category text="Education"><itunes:category text="Educational Technology"/></itunes:category><itunes:author>Vignesh</itunes:author><itunes:owner><itunes:email>noreply@blogger.com</itunes:email><itunes:name>Vignesh</itunes:name></itunes:owner><xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-1131718196915244986</guid><pubDate>Wed, 01 Apr 2009 14:08:00 +0000</pubDate><atom:updated>2009-04-01T07:22:09.826-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Polymorphism</title><description>&lt;div&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;  &lt;div shape="_x0000_s1026" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div class="O" style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272; mso-text-indent-alt:68;mso-char-wrap:1"&gt;&lt;span style="font-size:156%"&gt;&lt;span style="position: absolute; left: -3.64%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Polymorphism in a Java program &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div class="O1" style="mso-line-spacing:&amp;quot;93 0 -91&amp;quot;;mso-margin-left-alt:544; mso-text-indent-alt:363;mso-char-wrap:1"&gt;&lt;span style="color: red; "&gt;&lt;span style="color: black; position: absolute; left: -3.1%; top: 0.3em; font-family: Symbol; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: red; "&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: red; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The ability of a reference variable to change behavior &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: red; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;according to what object instance it is holding.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;This allows multiple objects of different subclasses to be &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;treated as objects of a single super class, while &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;automatically selecting the proper methods to apply to a &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;particular object based on the subclass it belongs to.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/div&gt;    &lt;div class="O" style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-margin-left-alt:272; mso-text-indent-alt:68;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;There are 3 forms of Polymorphism&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Method overloading&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: georgia; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Method overriding through inheritance&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: georgia; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Method overriding through the Java interface&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Example:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Given the parent class &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Person&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; and the subclass &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Student&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; of the previous examples, we add another subclass of &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Person&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; which is &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Employee&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span style=""&gt;&lt;span style="position: absolute; left: -3.14%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;In Java, we can create a reference that is of type super &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;class to an object of its subclass. For example,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-size: 37px;"&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in 9.5in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public static main( String[] args ) {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Student studentObject = new Student();&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Employee employeeObject = new Employee();&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:1;width:6.71%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Person ref = studentObject; // Person reference points&lt;/span&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:7;width:44.41%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;// to a Student object &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;String name = ref.getName();  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;}&lt;span class="Apple-style-span" style="font-size: 27px; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 27px; font-weight: bold; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Now suppose we have a &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;getName&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; method in our super &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;class &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Person&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;, and we override &lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 27px; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;this method in both &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Student&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;and &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Employee &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;subclass's&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 27px; font-weight: bold;"&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-size: 37px;"&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public class Student {  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:1;width:8.08%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public String &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: red; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;getName()&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;{  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:15.04%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;System.out.println(“Student Name:” + name);  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:16.17%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;return name;  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:1;width:8.08%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;} &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;}  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public class Employee {  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:1;width:8.08%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public String &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: red; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;getName()&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;{  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:14.76%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;System.out.println(“Employee Name:” + name);  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:16.17%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;return name;  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span style="mso-tab-count:1;width:8.08%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;}  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 27px;"&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span style=""&gt;&lt;span style="position: absolute; left: -3.13%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Going back to our main method, when we try to call the &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;getName&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; method of the reference &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Person&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;ref&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;, the &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;getName&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; method of the &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Student&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; object will be called. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span style=""&gt;&lt;span style="position: absolute; left: -3.52%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Now, if we assign &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;ref&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; to an &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Employee&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; object, the &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;getName&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; method of &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Employee&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; will be called.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: Arial; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span style=""&gt;&lt;span style="position: absolute; left: -2.97%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New'; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Another example that illustrates polymorphism is when we &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;try to pass a reference to methods as a parameter&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span style=""&gt;&lt;span style="position: absolute; left: -3.06%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;ul&gt;&lt;li&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Suppose we have a static method &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;printInformation&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; that &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;takes in a &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Person&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; reference as parameter&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public static printInformation( Person p ){ &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;// It will call getName() method of the &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;// actual object instance that is passed &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-spacerun:yes"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;p.getName(); &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-tab-count:1;width:8.96%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;ul&gt;&lt;li&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;We can actually pass a reference of type &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Employee&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; and type &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Student&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; to the &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;printInformation&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; method as long as it is a &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;subclass of the &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: blue; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt;Person&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;b&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: 16px; "&gt; class.&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-style: italic; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-style: italic; "&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public static main( String[] args )&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;‏&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;{ &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:17.03%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Student&lt;/span&gt;&lt;span style="mso-tab-count: 1;width:5.79%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;studentObject = new Student(); &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:16.57%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Employee&lt;/span&gt;&lt;span style="mso-tab-count: 1;width:4.07%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;employeeObject = new Employee(); &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:17.03%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:blue"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;printInformation( studentObject ); &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span style="mso-tab-count:2;width:17.03%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;p&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:blue"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;rintInformation( employeeObject ); &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;color:black"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;} &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span lang="EN-GB" style="font-family:Arial;mso-ascii-font-family:Arial;mso-bidi-font-family: &amp;quot;Lucida Sans Unicode&amp;quot;;font-size:28pt;color:black"&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/div&gt;&lt;/div&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-size: 37px;"&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-family: georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;p:colorscheme colors="#FFFFFF,#000000,#808080,#000000,#00CC99,#3333CC,#CCCCFF,#B2B2B2"&gt;&lt;span class="Apple-style-span" style="font-family: georgia;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/p:colorscheme&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/div&gt;</description><link>http://rapidjava.blogspot.com/2009/04/polymorphism.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-6339631609636755709</guid><pubDate>Thu, 12 Mar 2009 13:47:00 +0000</pubDate><atom:updated>2009-03-12T06:52:03.241-07:00</atom:updated><title>Do-while-loop</title><description>Do-while-loop&lt;br /&gt;&lt;br /&gt;-is similar to the while-loop&lt;br /&gt;-statements inside a do-while loop are executed several times as long as the condition is satisfied -The main difference between a while and do-while loop:&lt;br /&gt;&lt;strong&gt;The statements inside a do-while loop are executed at least once.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;do-while loop has the form:&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;statement1;&lt;br /&gt;statement2; . . .&lt;br /&gt;}while( boolean_expression );&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Example 1&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;int x = 0;&lt;br /&gt;do  { &lt;br /&gt;System.out.println(x); &lt;br /&gt;x++; &lt;br /&gt;}while (x&lt;10);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 2&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//infinite loop &lt;br /&gt;do{  &lt;br /&gt;System.out.println(“hello”); &lt;br /&gt;} while (true); &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 3&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//one loop &lt;br /&gt;// statement is executed once &lt;br /&gt;do   &lt;br /&gt;System.out.println(“hello”);  &lt;br /&gt;while (false);  &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;color:#ff0000;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Common programming mistakes when using the do-while loop is forgetting to write the semi-colon after the while expression.&lt;br /&gt;do{ ... }&lt;br /&gt;while(boolean_expression)//WRONG-&gt;forgot semicolon;&lt;br /&gt;&lt;br /&gt;Just like in while loops, make sure that your do-while loops will terminate at some point.</description><link>http://rapidjava.blogspot.com/2009/03/do-while-loop.html</link><thr:total>0</thr:total><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-7741896811868534167</guid><pubDate>Thu, 12 Mar 2009 13:39:00 +0000</pubDate><atom:updated>2009-03-12T06:46:35.032-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>While-loop</title><description>&lt;span style="font-size:130%;color:#ff0000;"&gt;&lt;strong&gt;While loop&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;-is a statement or block of statements that is repeated as long as some condition is satisfied.&lt;br /&gt;&lt;br /&gt;while loop has the form:&lt;br /&gt;&lt;br /&gt;while( boolean_expression )&lt;br /&gt;{&lt;br /&gt;statement1;&lt;br /&gt;statement2; . . .&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;-The statements inside the while loop are executed as long as the boolean_expression evaluates to true.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 1&lt;/strong&gt;&lt;br /&gt;int x = 0;&lt;br /&gt;while (x&lt;10) { System.out.println(x); x++; }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 2&lt;/strong&gt;&lt;br /&gt;//infinite loop&lt;br /&gt;while(true)&lt;br /&gt;System.out.println(“hello”);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Example 3&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//no loops&lt;br /&gt;  // statement is not even executed&lt;br /&gt; while (false)&lt;br /&gt; System.out.println(“hello”);</description><link>http://rapidjava.blogspot.com/2009/03/while-loop.html</link><thr:total>0</thr:total><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-8424764897340902378</guid><pubDate>Mon, 09 Mar 2009 14:25:00 +0000</pubDate><atom:updated>2009-03-09T07:33:35.028-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Switch Statements</title><description>&lt;ul&gt;&lt;li&gt; switch&lt;br /&gt;-allows branching on multiple outcomes. &lt;/li&gt;&lt;li&gt;switch statement has the form:&lt;/li&gt;&lt;/ul&gt;switch( switch_expression )&lt;br /&gt;{&lt;br /&gt; case case_selector1: statement1;&lt;br /&gt;// statement2;&lt;br /&gt;//block 1 break;&lt;br /&gt;case case_selector2: statement1;&lt;br /&gt;// statement2;&lt;br /&gt;//block 2  break;&lt;br /&gt;default: statement1;&lt;br /&gt;//  statement2;&lt;br /&gt;//block n&lt;br /&gt; }&lt;br /&gt;&lt;ul&gt;&lt;li&gt;where,&lt;br /&gt;-switch_expression&lt;br /&gt;lis an integer or character expression&lt;br /&gt;&lt;span style="font-size:85%;color:#ff0000;"&gt;-case_selector1, case_selector2 and so on,&lt;br /&gt;&lt;/span&gt;lare unique integer or character constants. &lt;/li&gt;&lt;li&gt;When a switch is encountered,&lt;br /&gt;-Java first evaluates the switch_expression, and jumps to the case whose selector matches the value of the expression.&lt;br /&gt;-The program executes the statements in order from that point on until a break statement is encountered, skipping then to the first statement after the end of the switch structure.&lt;br /&gt;-If none of the cases are satisfied, the default block is executed. Take note however, that  the default part is optional.&lt;/li&gt;&lt;li&gt;NOTE:&lt;br /&gt;-Unlike with the if statement, the multiple statements are executed in the switch statement without needing the curly braces.&lt;br /&gt;-When a case in a switch statement has been matched, all the statements associated with that case are executed. Not only that, the statements associated with the succeeding cases are also executed.&lt;br /&gt;-To prevent the program from executing statements in the subsequent cases, we use a break statement as our last statement. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; Deciding whether to use an if statement or a switch statement is a judgment call. You can decide which to use, based on readability and other factors.&lt;/li&gt;&lt;li&gt;An if statement can be used to make decisions based on ranges of values or conditions, whereas a switch statement can make decisions based only on a single integer or character value. Also, the value provided to each case statement must be unique.  &lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/03/switch-statements.html</link><thr:total>0</thr:total><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-470237875599960529</guid><pubDate>Fri, 06 Mar 2009 14:42:00 +0000</pubDate><atom:updated>2009-03-06T06:54:12.811-08:00</atom:updated><title>if - Statements</title><description>&lt;ul&gt;&lt;li&gt; if Statements are Decision control structures&lt;br /&gt;-Java statements that allows us to select and execute specific blocks of code while skipping other sections&lt;/li&gt;&lt;li&gt;Types:&lt;br /&gt;-if-statement&lt;br /&gt;-if-else-statement&lt;br /&gt;-If-else if-statement &lt;/li&gt;&lt;li&gt; if-statement&lt;br /&gt;-specifies that a statement (or block of code) will be executed if and only if a certain boolean statement is true. &lt;/li&gt;&lt;li&gt;if-statement has the form:if( boolean_expression )statement; or  if( boolean_expression ){ statement1; statement2; }&lt;br /&gt;-where, &lt;/li&gt;&lt;li&gt;boolean_expression is either a boolean expression or boolean variable. &lt;/li&gt;&lt;li&gt;Eg - &lt;/li&gt;&lt;li&gt;int grade = 68;&lt;/li&gt;&lt;li&gt; if( grade &gt; 60 ) &lt;/li&gt;&lt;li&gt;System.out.println("Congratulations!"); &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The boolean_expression part of a statement should evaluate to a boolean value. That means that the execution of the condition should either result to a value of true or a false. &lt;/li&gt;&lt;li&gt;Indent the statements inside the if-block.&lt;br /&gt;    For example,&lt;br /&gt;if( boolean_expression )&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;{                     //statement1; &lt;/p&gt;&lt;p&gt;                       //statement2;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt; if-else statement&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; if-else statement&lt;br /&gt;-used when we want to execute a certain statement if a condition is true, and a different statement if the condition is false.&lt;/li&gt;&lt;li&gt;if-else statement has the form:&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;if( boolean_expression )&lt;/p&gt;&lt;p&gt;{ statement1;&lt;/p&gt;&lt;p&gt;statement2; . . . }&lt;/p&gt;&lt;p&gt;else&lt;/p&gt;&lt;p&gt;{ statement3;&lt;/p&gt;&lt;p&gt;statement4; . . .} &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;int grade = 68;&lt;br /&gt;if( grade &gt; 60 )  &lt;br /&gt;System.out.println("Congratulations!");&lt;br /&gt;else&lt;br /&gt;System.out.println("Sorry you failed");&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; To avoid confusion, always place the statement or statements of an if or if-else block inside brackets {}. &lt;/li&gt;&lt;li&gt;You can have nested if-else blocks. This means that you can have other if-else blocks inside another if-else block. &lt;/li&gt;&lt;li&gt;For example,&lt;br /&gt;&lt;span style="font-size:85%;"&gt;if( boolean_expression ){ &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;if( boolean_expression )&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;{  //some statements here }&lt;br /&gt;}&lt;br /&gt;else{ //some statements here&lt;br /&gt;} &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;if-else-else if statement&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt; &lt;span style="font-size:100%;"&gt;The statement in the else-clause of an if-else block can be another if-else structures. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;This cascading of structures allows us to make more complex selections. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;The statement has the form:&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;if( boolean_expression1 )&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt; statement1;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt; else if( boolean_expression2 ) &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;statement2; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;else statement3; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-size:100%;"&gt;&lt;ul&gt;&lt;li&gt;Example&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;int grade = 68;&lt;br /&gt;if( grade &gt; 90 ){&lt;br /&gt;System.out.println("Very good!");&lt;br /&gt;}&lt;br /&gt;else if( grade &gt; 60 ){&lt;br /&gt;System.out.println("Very good!");&lt;br /&gt;}&lt;br /&gt;else{&lt;br /&gt;System.out.println("Sorry you failed");&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;strong&gt;&lt;span style="font-size:130%;"&gt;Common Errors&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The condition inside the if-statement does not evaluate to a boolean value. For example,&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="color:#ff0000;"&gt; //WRONG&lt;/span&gt;  &lt;/p&gt;&lt;p&gt;int number = 0;  &lt;/p&gt;&lt;p&gt;if( number )&lt;/p&gt;&lt;p&gt;{ //some statements here } &lt;/p&gt;&lt;p&gt;The variable number does not hold a boolean value&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Writing elseif instead of else if.&lt;br /&gt;&lt;br /&gt;Using = instead of == for comparison. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;For example, &lt;/p&gt;&lt;p&gt;&lt;span style="color:#ff0000;"&gt;//WRONG&lt;/span&gt; &lt;/p&gt;&lt;p&gt; int number = 0;  &lt;/p&gt;&lt;p&gt;if( number = 0 )&lt;/p&gt;&lt;p&gt;{ //some statements here } &lt;/p&gt;&lt;p&gt;This should be written as, &lt;/p&gt;&lt;p&gt;&lt;span style="color:#ff0000;"&gt;//CORRECT&lt;/span&gt;  &lt;/p&gt;&lt;p&gt;int number = 0;  &lt;/p&gt;&lt;p&gt;if( number == 0 )&lt;/p&gt;&lt;p&gt;{ //some statements here}&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;</description><link>http://rapidjava.blogspot.com/2009/03/if-statements.html</link><thr:total>0</thr:total><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-3748770476958116948</guid><pubDate>Thu, 05 Mar 2009 14:08:00 +0000</pubDate><atom:updated>2009-03-05T06:23:21.182-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Introduction to Arrays</title><description>&lt;ul&gt;&lt;li&gt; Suppose we have here three variables of type int with different identifiers for each variable. &lt;/li&gt;&lt;/ul&gt;int number1;&lt;br /&gt;int number2;&lt;br /&gt;int number3;&lt;br /&gt;&lt;br /&gt;number1 = 1;&lt;br /&gt;number2 = 2;&lt;br /&gt;number3 = 3;&lt;br /&gt;&lt;br /&gt;As you can see, it seems like a tedious task in order to just initialize and use the variables especially if they are used for the same purpose.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In Java and other programming languages, there is one capability wherein we can use one variable to store a list of data and manipulate them more efficiently. This type of variable is called an array. &lt;/li&gt;&lt;li&gt;An array stores multiple data items of the same data type, in a contiguous block of memory, divided into a number of slots.&lt;/li&gt;&lt;/ul&gt; &lt;br /&gt;&lt;p&gt; &lt;strong&gt;&lt;span style="font-size:130%;"&gt;Declaration ofan Array&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;To declare an array, write the data type, followed by a set of square brackets[], followed by the identifier name.&lt;/li&gt;&lt;li&gt;For example, &lt;/li&gt;&lt;/ul&gt;int []ages;&lt;br /&gt;or&lt;br /&gt;int ages[];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Instantiation of an Array&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt; After declaring, we must create the array and specify its length with a constructor statement. &lt;/li&gt;&lt;li&gt;Definitions:&lt;br /&gt;-Instantiation &lt;/li&gt;&lt;li&gt;In Java, this means creation&lt;br /&gt;-Constructor &lt;/li&gt;&lt;li&gt;In order to instantiate an object, we need to use a constructor for this. A constructor is a method that is called to create a certain object. &lt;/li&gt;&lt;li&gt;We will cover more about instantiating objects and constructors later. &lt;/li&gt;&lt;li&gt;To instantiate (or create) an array, write the new keyword, followed by the square brackets containing the number of elements you want the array to have. &lt;/li&gt;&lt;li&gt;For example,&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;//declaration int ages[];  &lt;/p&gt;&lt;p&gt;instantiate objectages = new int[100];&lt;/p&gt;&lt;p&gt;or, can also be written as, &lt;/p&gt;&lt;p&gt;//declare and instantiate object &lt;/p&gt;&lt;p&gt;int ages[] = new int[100]; &lt;/p&gt;&lt;ul&gt;&lt;li&gt;You can also instantiate an array by directly initializing it with data.&lt;/li&gt;&lt;li&gt;For example,int arr[] = {1, 2, 3, 4, 5};This statement declares and instantiates an array of integers with five elements (initialized to the values 1, 2, 3, 4, and 5). &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Accessing Array Element&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; To access an array element, or a part of the array, you use a number called an &lt;span style="color:#ff0000;"&gt;index&lt;/span&gt; or a &lt;span style="color:#ff0000;"&gt;subscript&lt;/span&gt;.  &lt;/li&gt;&lt;li&gt;Index number or Subscript&lt;br /&gt;-assigned to each member of the array, to allow the program to access an individual member of the array.&lt;br /&gt;-begins with zero and progress sequentially by whole numbers to the end of the array.&lt;br /&gt;-NOTE: Elements inside your array are from 0 to (sizeOfArray-1). &lt;/li&gt;&lt;li&gt;For example, given the array we declared a while ago, we have &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;//assigns 10 to the first element in the array ages[0] = 10;  &lt;/p&gt;&lt;p&gt;//prints the last element in the array System.out.print(ages[99]); &lt;/p&gt;&lt;ul&gt;&lt;li&gt;NOTE:&lt;br /&gt;-once an array is declared and constructed, the stored value of each member of the array will be initialized to zero for number data.&lt;br /&gt;-for reference data types such as Strings, they are NOT initialized to blanks or an empty string “”. Therefore, you must populate the String arrays explicitly. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It is usually better to initialize or instantiate the array right away after you declare it. For example, the declaration, &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;int []arr = new int[100];    is preferred over, &lt;/p&gt;&lt;ul&gt;&lt;li&gt; It is usually better to initialize or instantiate the array right away after you declare it. For example, the declaration, &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;int []arr = new int[100];    is preferred over, &lt;/p&gt;&lt;p&gt;int []arr; arr = new int[100]; &lt;/p&gt;&lt;p&gt;int []arr; arr = new int[100]; &lt;/p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Array Length&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; In order to get the number of elements in an array, you can use the length field of an array. &lt;/li&gt;&lt;li&gt;The length field of an array returns the size of the array. It can be used by writing,&lt;br /&gt;arrayName.length &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;When creating for loops to process the elements of an array, use the array object's length field in the condition statement of the for loop. This will allow the loop to adjust automatically for different-sized arrays. &lt;/li&gt;&lt;li&gt;Declare the sizes of arrays in a Java program using named constants to make them easy to change. For example, final int ARRAY_SIZE = 1000; //declare a constant  . . . int[] ages = new int[ARRAY_SIZE]; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Multi-Dimensional Array&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;/span&gt;&lt;/strong&gt; Multidimensional arrays are implemented as arrays of arrays. &lt;/li&gt;&lt;li&gt;Multidimensional arrays are declared by appending the appropriate number of bracket pairs after the array name. &lt;/li&gt;&lt;li&gt;To access an element in a multidimensional array is just the same as accessing the elements in a one dimensional array.&lt;/li&gt;&lt;li&gt;For example, to access the first element in the first row of the array dogs, we write, System.out.print( dogs[0][0] ); &lt;/li&gt;&lt;li&gt;This will print the String "terry" on the screen.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/03/introduction-to-arrays.html</link><thr:total>0</thr:total><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-1097990807220829211</guid><pubDate>Thu, 05 Mar 2009 11:28:00 +0000</pubDate><atom:updated>2009-03-05T03:32:46.080-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Command-line Arguments</title><description>&lt;p:colorscheme colors="#ffffff,#000000,#808080,#000000,#00cc99,#3333cc,#ccccff,#b2b2b2"&gt;  &lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;93 0 -85&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;span style="font-size:133%"&gt;&lt;span style="position: absolute; left: -3.09%; top: 1.12em; font-family: Wingdings; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;l&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;A Java application can accept any number of arguments from the &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;command-line. &lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;Command-line arguments allow the user to affect the operation of an &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;application. &lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-family: Georgia; "&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;The user enters command-line arguments when invoking the &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;application and specifies them after the name of the class to run.  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;p:colorscheme colors="#ffffff,#000000,#808080,#000000,#00cc99,#3333cc,#ccccff,#b2b2b2"&gt;  &lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;In Java, when you invoke an application, the runtime system passes the command-line arguments to the application's main method via &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;an array of Strings.&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;public static void main( &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: red; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;String[] args&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; ) &lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span lang="EN-GB" style="font-family: Arial; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Each String in the array contains one of the command-line arguments&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Example:&lt;/span&gt;&lt;/div&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div shape="_x0000_s1026" class="O" style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;; mso-margin-left-alt:272;mso-text-indent-alt:68;mso-char-wrap:1;tab-interval: .5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in 7.9166in 8.7083in"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;p:colorscheme colors="#ffffff,#000000,#808080,#000000,#00cc99,#3333cc,#ccccff,#b2b2b2"&gt;  &lt;div shape="_x0000_s1026" class="O" style="tab-interval:.5in;tab-stops:.7916in 1.5833in 2.375in 3.1666in 3.9583in 4.75in 5.5416in 6.3333in 7.125in"&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family:&amp;quot;Courier New&amp;quot;;font-size:111%"&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;public class CommandLineSample &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;2&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;{ &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;3&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:1;width:3.37%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;public static void main( String[] args ){ &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:2;width:12.54%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;5&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:2;width:12.54%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;for(int i=0; i&lt;args.length;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;6&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:3;width:21.7%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;System.out.println( args[i] ); &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;7&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:2;width:12.54%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;} &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;8&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:1;width:3.37%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family: 'Courier New'; "&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;9&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family: 'Courier New'; color: black; "&gt;&lt;span style="mso-tab-count:1;width:3.37%"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;} &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 0 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;span style="font-family:&amp;quot;Courier New&amp;quot;;font-size:111%"&gt;&lt;span style="mso-special-format:&amp;quot;numbullet13\,1&amp;quot;;position:absolute;left:-5.99%"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-family:&amp;quot;Courier New&amp;quot;;mso-ascii-font-family:&amp;quot;Courier New&amp;quot;; mso-bidi-font-family:&amp;quot;Lucida Sans Unicode&amp;quot;;font-size:20pt;color:black"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;}  &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-margin-left-alt:288;mso-char-wrap: 1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/span&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="mso-line-spacing:&amp;quot;89 50 0&amp;quot;;mso-margin-left-alt:272;mso-text-indent-alt: 68;mso-char-wrap:1"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/p:colorscheme&gt;</description><link>http://rapidjava.blogspot.com/2009/03/command-line-arguments.html</link><thr:total>1</thr:total><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-4383622441808212262</guid><pubDate>Wed, 25 Feb 2009 14:17:00 +0000</pubDate><atom:updated>2009-02-25T06:25:58.924-08:00</atom:updated><title>Logical Operators</title><description>&lt;ul&gt;&lt;li&gt;Logical operators have one or two boolean operands that yield a boolean result. &lt;/li&gt;&lt;li&gt;There are six logical operators:&lt;br /&gt;- &amp;amp;&amp;amp; (logical AND)‏&lt;br /&gt;-&amp;amp; (boolean logical AND)‏&lt;br /&gt;- (logical OR)‏&lt;br /&gt;- (boolean logical inclusive OR)‏&lt;br /&gt;-^ (boolean logical exclusive OR)‏&lt;br /&gt;-! (logical NOT)‏ &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&amp;amp;&amp;amp;(logical) and &amp;amp;(boolean logical) AND&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; The basic difference between &amp;amp;&amp;amp; and &amp;amp; operators :&lt;br /&gt;-&amp;amp;&amp;amp; supports short-circuit evaluations (or partial evaluations), while &amp;amp; doesn't. &lt;/li&gt;&lt;li&gt;Given an expression:exp1 &amp;amp;&amp;amp; exp2&lt;br /&gt;-&amp;amp;&amp;amp; will evaluate the expression exp1, and immediately return a false value is exp1 is false. -If exp1 is false, the operator never evaluates exp2 because the result of the operator will be false regardless of the value of exp2. &lt;/li&gt;&lt;li&gt;In contrast, the &amp;amp; operator always evaluates both exp1 and exp2 before returning an answer. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt; (logical) and  (boolean logical) inclusive OR &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; The basic difference between  and I operators :&lt;br /&gt;- supports short-circuit evaluations (or partial evaluations), while  doesn't. &lt;/li&gt;&lt;li&gt;Given an expression:exp1  exp2&lt;br /&gt;- will evaluate the expression exp1, and immediately return a true value is exp1 is true&lt;br /&gt;-If exp1 is true, the operator never evaluates exp2 because the result of the operator will be true regardless of the value of exp2.&lt;br /&gt;-In contrast, the  operator always evaluates both exp1 and exp2 before returning an answer.  &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;^ (boolean logical exclusive OR) &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; The result of an exclusive OR operation is TRUE, if and only if one operand is true and the other is false. &lt;/li&gt;&lt;li&gt;Note that both operands must always be evaluated in order to calculate the result of an exclusive OR. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;! ( logical  NOT)‏&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; The logical NOT takes in one argument, wherein that argument can be an expression, variable or constant. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Conditional Operator (?:)‏&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; The conditional operator ?:&lt;br /&gt;-is a ternary operator. &lt;/li&gt;&lt;li&gt;This means that it takes in three arguments that together form a conditional expression.&lt;br /&gt;-The structure of an expression using a conditional operator isexp1?exp2:exp3&lt;br /&gt;wherein,&lt;br /&gt;exp1 - is a boolean expression whose result must either be true or false&lt;br /&gt;-Result:&lt;br /&gt;If exp1 is true, exp2 is the value returned.&lt;br /&gt;If it is false, then exp3 is returned.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/logical-operators.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-5515039260314292815</guid><pubDate>Wed, 25 Feb 2009 14:14:00 +0000</pubDate><atom:updated>2009-02-25T06:16:58.612-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Relational Operators</title><description>&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAKs9ikjMI6P-sVn94XzBzwb6sC3wabK-PSeQtOSfren4Bv62PiHbpcdH6p4ig0ARjedGNB_F_6h0TXuJjZd9pzZR9fDymWPVQQ-_rW1YEee3hbKiWDTZ1h_UODiH_JLCn_MRuDpVWojzJ/s1600-h/ja.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5306738709602921090" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 185px; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAKs9ikjMI6P-sVn94XzBzwb6sC3wabK-PSeQtOSfren4Bv62PiHbpcdH6p4ig0ARjedGNB_F_6h0TXuJjZd9pzZR9fDymWPVQQ-_rW1YEee3hbKiWDTZ1h_UODiH_JLCn_MRuDpVWojzJ/s400/ja.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Relational operators compare two values and determines the relationship between those values. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;The output of evaluation are the boolean values true or false. &lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/relational-operators.html</link><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAKs9ikjMI6P-sVn94XzBzwb6sC3wabK-PSeQtOSfren4Bv62PiHbpcdH6p4ig0ARjedGNB_F_6h0TXuJjZd9pzZR9fDymWPVQQ-_rW1YEee3hbKiWDTZ1h_UODiH_JLCn_MRuDpVWojzJ/s72-c/ja.JPG" width="72"/><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-4496842704841537252</guid><pubDate>Mon, 23 Feb 2009 10:02:00 +0000</pubDate><atom:updated>2009-02-23T02:06:58.898-08:00</atom:updated><title>Increment and Decrement Operators</title><description>&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivTkkvvAtO3acFN_U7FmNl2kWVYmdM6IYbL6U2dxOOtcvJ8n5ZU6fgCTW3s3XJTl5bT7txbe9A4rzVS-FYmu1GygetjUIc0NMHa8J8AqSxvpVoPPQ6l__0-UMF-tmtH2SOUxaExmcEx1zz/s1600-h/jj.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5305931699374816530" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 212px" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivTkkvvAtO3acFN_U7FmNl2kWVYmdM6IYbL6U2dxOOtcvJ8n5ZU6fgCTW3s3XJTl5bT7txbe9A4rzVS-FYmu1GygetjUIc0NMHa8J8AqSxvpVoPPQ6l__0-UMF-tmtH2SOUxaExmcEx1zz/s400/jj.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;unary increment operator (++) &lt;/li&gt;&lt;li&gt;unary decrement operator (--)‏ &lt;/li&gt;&lt;li&gt;Increment and decrement operators increase and decrease a value stored in a number variable by 1. &lt;/li&gt;&lt;li&gt;For example, the expression, count=count + 1;//increment the value of count by 1 is equivalent to, count++; &lt;/li&gt;&lt;li&gt;The increment and decrement operators can be placed before or after an operand. &lt;/li&gt;&lt;li&gt;When used before an operand, it causes the variable to be incremented or decremented by 1, and then the new value is used in the expression in which it appears. &lt;/li&gt;&lt;li&gt;For example, &lt;/li&gt;&lt;/ul&gt;int i = 10;&lt;br /&gt;int j = 3;&lt;br /&gt;int k = 0;&lt;br /&gt;k = ++j + i; //will result to k = 4+10 = 14&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When the increment and decrement operators are placed after the operand, the old value of the variable will be used in the expression where it appears. &lt;/li&gt;&lt;li&gt;For example,&lt;br /&gt;int i = 10;&lt;br /&gt;int j = 3;&lt;br /&gt;int k = 0;&lt;br /&gt;k = j++ + i; //will result to k = 3+10 = 13&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/increment-and-decrement-operators.html</link><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivTkkvvAtO3acFN_U7FmNl2kWVYmdM6IYbL6U2dxOOtcvJ8n5ZU6fgCTW3s3XJTl5bT7txbe9A4rzVS-FYmu1GygetjUIc0NMHa8J8AqSxvpVoPPQ6l__0-UMF-tmtH2SOUxaExmcEx1zz/s72-c/jj.JPG" width="72"/><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-802824683078073314</guid><pubDate>Mon, 23 Feb 2009 09:59:00 +0000</pubDate><atom:updated>2009-02-23T02:01:58.460-08:00</atom:updated><title>Arithmetic Operators</title><description>&lt;p&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg90DU3mKN2u2UrP8rT-qxCbFLmsgXV_fADTQprI0j-MLpzDvaBHxJoR5wxAanp3AHMR8ev101ixPGWa9OeqbdcYMfoY68rOjKnS8wCqNyc60dnTmY96G0a5JpsZepxot01ZH3xnCsJdjQT/s1600-h/jj.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5305930681561506226" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 185px; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg90DU3mKN2u2UrP8rT-qxCbFLmsgXV_fADTQprI0j-MLpzDvaBHxJoR5wxAanp3AHMR8ev101ixPGWa9OeqbdcYMfoY68rOjKnS8wCqNyc60dnTmY96G0a5JpsZepxot01ZH3xnCsJdjQT/s400/jj.JPG" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Note:&lt;br /&gt;-When an integer and a floating-point number are used as operands to a single arithmetic operation, the result is a floating point. The integer is implicitly converted to a floating-point number before the operation takes place.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/arithmetic-operators.html</link><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg90DU3mKN2u2UrP8rT-qxCbFLmsgXV_fADTQprI0j-MLpzDvaBHxJoR5wxAanp3AHMR8ev101ixPGWa9OeqbdcYMfoY68rOjKnS8wCqNyc60dnTmY96G0a5JpsZepxot01ZH3xnCsJdjQT/s72-c/jj.JPG" width="72"/><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-3065913117442037313</guid><pubDate>Mon, 23 Feb 2009 09:55:00 +0000</pubDate><atom:updated>2009-02-23T01:59:40.602-08:00</atom:updated><title>Operators</title><description>&lt;ul&gt;&lt;li&gt;Different types of operators:&lt;br /&gt;-arithmetic operators&lt;br /&gt;-relational operators&lt;br /&gt;-logical operators&lt;br /&gt;-conditional operators&lt;/li&gt;&lt;li&gt;These operators follow a certain kind of precedence so that the compiler will know which operator to evaluate first in case multiple operators are used in one statement.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/operators.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-6326178200073965598</guid><pubDate>Mon, 23 Feb 2009 09:48:00 +0000</pubDate><atom:updated>2009-02-23T01:54:59.687-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Variables</title><description>&lt;ul&gt;&lt;li&gt;A variable is an item of data used to store the state of objects. &lt;/li&gt;&lt;li&gt;A variable has a:&lt;br /&gt;-data type &lt;/li&gt;&lt;li&gt;The data type indicates the type of value that the variable can hold.&lt;br /&gt;-name  &lt;/li&gt;&lt;li&gt;The variable name must follow rules for identifiers. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Declaring Variables&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Declare a variable as follows:&lt;br /&gt;&lt;data&gt;  &lt;name&gt; [=initial value]; &lt;/li&gt;&lt;li&gt;Note: Values enclosed in &lt;&gt; are required values, while those values in [] are optional. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;It always good to initialize your variables as you declare them. &lt;/li&gt;&lt;li&gt;Use descriptive names for your variables. Like for example, if you want to have a variable that contains a grade for a student, name it as, grade and not just some random letters you choose.&lt;/li&gt;&lt;li&gt;Declare one variable per line of code. For example, the variable declarations,&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;double exam=0;&lt;/p&gt;&lt;p&gt;double quiz=10;&lt;/p&gt;&lt;p&gt;double grade = 0;&lt;br /&gt;   is preferred over the declaration,&lt;br /&gt;double exam=0, quiz=10, grade=0;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/variables.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-3816173803562715556</guid><pubDate>Sat, 21 Feb 2009 12:23:00 +0000</pubDate><atom:updated>2009-02-21T04:55:52.598-08:00</atom:updated><title>Primitive Data Types</title><description>&lt;ul&gt;&lt;br /&gt;&lt;li&gt;The Java programming language defines eight primitive data types.&lt;br /&gt;-boolean (for logical)‏&lt;br /&gt;-char (for textual)‏&lt;br /&gt;-byte&lt;br /&gt;-short&lt;br /&gt;-int&lt;br /&gt;-long (integral)‏&lt;br /&gt;-double&lt;br /&gt;-float (floating point). &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Logical-boolean&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;A boolean data type represents two states: true and false.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;An example is, boolean result = true; &lt;/li&gt;&lt;br /&gt;&lt;li&gt;The example shown above, declares a variable named result as &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;boolean&lt;/span&gt;&lt;/strong&gt; type and assigns it a value of &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;true&lt;/strong&gt;&lt;/span&gt;. &lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Textual-char&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;A character data type (char), represents a single Unicode character. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;It must have its literal enclosed in single quotes(’ ’). &lt;/li&gt;&lt;br /&gt;&lt;li&gt;For example: &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;‘a’&lt;/strong&gt;&lt;/span&gt; //The letter a &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;‘\t’&lt;/strong&gt;&lt;/span&gt; //A tab &lt;/li&gt;&lt;br /&gt;&lt;li&gt;To represent special characters like ' (single quotes) or " (double quotes), use the escape character &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;'\'&lt;/span&gt;&lt;/strong&gt;. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;For example, &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;'\''&lt;/strong&gt;&lt;/span&gt; //for single quotes&lt;span style="color:#ff0000;"&gt;&lt;strong&gt; '\"'&lt;/strong&gt;&lt;/span&gt; //for double quotes &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Although, String is not a primitive data type (it is a Class), we will just introduce String in this section. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;A String represents a data type that contains multiple characters. It is not a primitive data type, it is a class. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;It has its literal enclosed in double quotes(“”). &lt;/li&gt;&lt;br /&gt;&lt;li&gt;For example: String message&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;=“Hello world!”;&lt;/strong&gt;&lt;/span&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Integral – byte, short, int &amp;amp; long &lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Integral data types in Java uses three forms – decimal, octal or hexadecimal. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Examples are, 2 //The decimal value 2 077 //The leading 0 indicates an octal value 0xBACC //The leading 0x indicates a hex value &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Integral types has int as default data type. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;You can define its long value by appending the letter l or L. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;For example:10L &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Floating Point – float and double &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Floating point types has double as default data type. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Floating-point literal includes either a decimal point or one of the following, E or e //(add exponential value) &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;F&lt;/strong&gt;&lt;/span&gt; or &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;f&lt;/span&gt;&lt;/strong&gt; //(float) &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;D&lt;/strong&gt;&lt;/span&gt; or &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;d&lt;/strong&gt;&lt;/span&gt; //(double) &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Examples are: &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;3.14 //A simple floating-point value (a double)&lt;/p&gt;&lt;p&gt;6.02E23 //A large floating-point value &lt;/p&gt;&lt;p&gt;2.718F //A simple float size value &lt;/p&gt;&lt;p&gt;123.4E+306D//A large double value with redundant D&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/primitive-data-types.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-5538787852648131861</guid><pubDate>Fri, 20 Feb 2009 06:15:00 +0000</pubDate><atom:updated>2009-02-19T22:24:19.373-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Literals</title><description>&lt;ul&gt;&lt;li&gt; Literals are tokens that do not change - they are constant.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The different types of literals in Java are:&lt;br /&gt;-Integer Literals&lt;br /&gt;-Floating-Point Literals&lt;br /&gt;-Boolean Literals&lt;br /&gt;-Character Literals&lt;br /&gt;-String Literals &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Integer Literals&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; Integer literals come in different formats:&lt;br /&gt;-decimal (base 10)‏&lt;br /&gt;-hexadecimal (base 16)‏&lt;br /&gt;-octal (base 8). &lt;/li&gt;&lt;li&gt;Special Notations in using integer literals in our programs:&lt;br /&gt;&lt;strong&gt;-Decimal&lt;br /&gt;&lt;/strong&gt;No special notation&lt;br /&gt;example: 12&lt;br /&gt;&lt;strong&gt;-Hexadecimal &lt;/strong&gt;&lt;br /&gt;Precede by 0x or 0X&lt;br /&gt;example: 0xC&lt;br /&gt;&lt;strong&gt;-Octal&lt;br /&gt;&lt;/strong&gt;Precede by 0&lt;br /&gt;example: 014&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Floating Point Literals&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; Represents decimals with fractional parts&lt;br /&gt;-Example: 3.1416&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Can be expressed in standard or scientific notation&lt;br /&gt;-Example: 583.45 (standard), 5.8345e2 (scientific)‏ &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Boolean&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Boolean literals have only two values,  &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;true&lt;/strong&gt;&lt;/span&gt; or &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;false&lt;/strong&gt;&lt;/span&gt;. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Character Literals&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Character Literals represent single Unicode characters.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Unicode character&lt;br /&gt;-a 16-bit character set that replaces the 8-bit ASCII character set.&lt;br /&gt;-Unicode allows the inclusion of symbols and special characters from other languages. &lt;/li&gt;&lt;li&gt; To use a character literal, enclose the character in single quote delimiter.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;For example&lt;br /&gt;-the letter a, is represented as  &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;‘a’&lt;/strong&gt;&lt;/span&gt;. &lt;br /&gt;-special characters such as a newline character, a backslash is used followed by the character code. For example, &lt;span style="color:#ff0000;"&gt;‘&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;\n’&lt;/strong&gt;&lt;/span&gt; for the newline character, &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;‘\r’&lt;/strong&gt;&lt;/span&gt; for the carriage return, &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;‘\b’&lt;/strong&gt;&lt;/span&gt; for backspace, &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;'\t'&lt;/strong&gt;&lt;/span&gt; for tab.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;String Literals&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;String literals represent multiple characters and are enclosed by double quotes.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;An example of a string literal is, “Hello World”. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/literals.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-2546821480956829815</guid><pubDate>Fri, 20 Feb 2009 06:05:00 +0000</pubDate><atom:updated>2009-02-19T22:13:52.614-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Keywords</title><description>&lt;ul&gt;&lt;li&gt; Keywords are predefined identifiers reserved by Java for a specific purpose.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You cannot use keywords as names for your variables, classes, methods ... etc.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Below is the list of the Java Keywords. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;ul&gt;&lt;li&gt;abstract&lt;/li&gt;&lt;li&gt;boolean&lt;/li&gt;&lt;li&gt;break&lt;/li&gt;&lt;li&gt;byte&lt;/li&gt;&lt;li&gt;bytevalue&lt;/li&gt;&lt;li&gt;case&lt;/li&gt;&lt;li&gt;catch&lt;/li&gt;&lt;li&gt;char&lt;/li&gt;&lt;li&gt;class&lt;/li&gt;&lt;li&gt;const&lt;/li&gt;&lt;li&gt;continue&lt;/li&gt;&lt;li&gt;default&lt;/li&gt;&lt;li&gt;do&lt;/li&gt;&lt;li&gt;double&lt;/li&gt;&lt;li&gt;else&lt;/li&gt;&lt;li&gt;extends&lt;/li&gt;&lt;li&gt;false&lt;/li&gt;&lt;li&gt;final&lt;/li&gt;&lt;li&gt;finally&lt;/li&gt;&lt;li&gt;for&lt;/li&gt;&lt;li&gt;goto&lt;/li&gt;&lt;li&gt;if&lt;/li&gt;&lt;li&gt;implements&lt;/li&gt;&lt;li&gt;import&lt;/li&gt;&lt;li&gt;instanceof&lt;/li&gt;&lt;li&gt;int&lt;/li&gt;&lt;li&gt;interface&lt;/li&gt;&lt;li&gt;long&lt;/li&gt;&lt;li&gt;native&lt;/li&gt;&lt;li&gt;null&lt;/li&gt;&lt;li&gt;package&lt;/li&gt;&lt;li&gt;private&lt;/li&gt;&lt;li&gt;protected&lt;/li&gt;&lt;li&gt;public&lt;/li&gt;&lt;li&gt;return&lt;/li&gt;&lt;li&gt;short&lt;/li&gt;&lt;li&gt;static&lt;/li&gt;&lt;li&gt;super&lt;/li&gt;&lt;li&gt;switch&lt;/li&gt;&lt;li&gt;synchronized&lt;/li&gt;&lt;li&gt;this&lt;/li&gt;&lt;li&gt;threadsafe&lt;/li&gt;&lt;li&gt;throw&lt;/li&gt;&lt;li&gt;transient&lt;/li&gt;&lt;li&gt;true&lt;/li&gt;&lt;li&gt;try&lt;/li&gt;&lt;li&gt;void&lt;/li&gt;&lt;li&gt;while&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/keywords.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-2461182656397417634</guid><pubDate>Fri, 20 Feb 2009 05:59:00 +0000</pubDate><atom:updated>2009-02-19T22:04:57.182-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Identifiers</title><description>&lt;ul&gt;&lt;li&gt;Identifiers&lt;br /&gt;-are tokens that represent names of variables, methods, classes, etc.&lt;br /&gt;-Examples of identifiers are: Hello, main, System, out.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Java identifiers are case-sensitive.&lt;br /&gt;-This means that the identifier Hello is not the same as hello. &lt;/li&gt;&lt;li&gt;Identifiers must begin with either a letter, an underscore “_”, or a dollar sign “$”. Letters may be lower or upper case. Subsequent characters may use numbers 0 to 9.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Identifiers cannot use Java keywords like class, public, void, etc. We will discuss more about Java keywords later. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; For names of classes, capitalize the first letter of the class name. For example,&lt;br /&gt;ThisIsAnExampleOfClassName&lt;br /&gt;&lt;/li&gt;&lt;li&gt;For names of methods and variables, the first letter of the word should start with a small letter. For example,&lt;br /&gt;thisIsAnExampleOfMethodName&lt;br /&gt; &lt;/li&gt;&lt;li&gt;In case of multi-word identifiers, use capital letters to indicate the start of the word except the first word. For example,&lt;br /&gt;charArray, fileNumber, ClassName.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Avoid using underscores at the start of the identifier such as _read or _write.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/identifiers.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-2221036468740349538</guid><pubDate>Fri, 20 Feb 2009 05:51:00 +0000</pubDate><atom:updated>2009-02-19T21:58:04.301-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Statements &amp; Blocks</title><description>&lt;ul&gt;&lt;li&gt; &lt;strong&gt;&lt;span style="font-size:130%;"&gt;Statement&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;-one or more lines of code terminated by a semicolon.&lt;br /&gt;-Example:System.out.println(“Hello world”); &lt;br /&gt;&lt;/li&gt;&lt;li&gt; &lt;strong&gt;&lt;span style="font-size:130%;"&gt;Block&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;-is one or more statements bounded by an opening and closing curly braces that groups the statements as one unit.&lt;br /&gt;-Block statements can be nested indefinitely.&lt;br /&gt;-Any amount of white space is allowed.&lt;br /&gt;-Example:&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; -public static void main( String[] args )&lt;/p&gt;&lt;p&gt;{&lt;/p&gt;&lt;p&gt;System.out.println("Hello"); &lt;/p&gt;&lt;p&gt;System.out.println("world”);&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt; &lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Coding Guidelines:&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;In creating blocks, you can place the opening curly brace in line with the statement. For example:&lt;br /&gt;public static void main( String[] args ){&lt;br /&gt;    or you can place the curly brace on the next line, like,&lt;br /&gt;public static void main( String[] args )‏&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You should indent the next statements after the start of a block. For example:&lt;br /&gt;public static void main( String[] args ){&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;System.out.println("Hello");&lt;br /&gt;System.out.println("world");&lt;br /&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;   &lt;/p&gt;&lt;p&gt;           &lt;br /&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/statements-blocks.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-8280584053197046564</guid><pubDate>Fri, 20 Feb 2009 05:46:00 +0000</pubDate><atom:updated>2009-02-19T21:51:34.270-08:00</atom:updated><title>Java Comments</title><description>&lt;ul&gt;&lt;li&gt; &lt;strong&gt;&lt;span style="font-size:130%;"&gt;Comments&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;-These are notes written to a code for documentation purposes.&lt;br /&gt;-Those texts are not part of the program and does not affect the flow of the program.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;3 Types of comments in Java&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;-C++ Style Comments&lt;br /&gt;-C Style Comments&lt;br /&gt;-Special Javadoc Comments &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;C++-Style Comments &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;ul&gt;&lt;li&gt;&lt;/span&gt;&lt;/strong&gt;C++ Style comments starts with //&lt;/li&gt;&lt;li&gt;All the text after // are treated as comments &lt;/li&gt;&lt;li&gt;For example: // This is a C++ style or single line comments  &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;C-Style Comments &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;ul&gt;&lt;li&gt;&lt;/span&gt;&lt;/strong&gt;C-style comments or also called multiline comments starts with a /* and ends with a */. &lt;/li&gt;&lt;li&gt;All text in between the two delimeters are treated as comments. &lt;/li&gt;&lt;li&gt;Unlike C++ style comments, it can span multiple lines. &lt;/li&gt;&lt;li&gt;For example: /* this is an exmaple of a        C style or multiline comments */ &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Special Javadoc Comments &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;&lt;ul&gt;&lt;li&gt;&lt;/span&gt;&lt;/strong&gt;Special Javadoc comments are used for generating an HTML documentation for your Java programs. &lt;/li&gt;&lt;li&gt;You can create javadoc comments by starting the line with /** and ending it with */. &lt;/li&gt;&lt;li&gt;Like C-style comments, it can also span lines. &lt;/li&gt;&lt;li&gt;It can also contain certain tags to add more information to your comments. &lt;/li&gt;&lt;li&gt;For example: /** This is an example of special java doc  comments used for \n  generating an html  documentation. It uses tags like:   @author Vignesh @version 1.5*/ &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/java-comments.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-4664208011166462610</guid><pubDate>Fri, 20 Feb 2009 05:45:00 +0000</pubDate><atom:updated>2009-02-19T21:46:32.354-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Coding Guidelines</title><description>&lt;ul&gt;&lt;li&gt;The Java programs should always end with the .java extension.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Filenames should match the name of your public class. So for example, if the name of your public class is Hello, you should save it in a file called Hello.java.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You should write comments in your code explaining what a certain class does, or what a certain method do. &lt;/li&gt;&lt;/ul&gt;</description><link>http://rapidjava.blogspot.com/2009/02/coding-guidelines.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-6942301544634876050</guid><pubDate>Thu, 19 Feb 2009 11:57:00 +0000</pubDate><atom:updated>2009-02-19T04:14:43.638-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Analyzing the Basic Program</title><description>&lt;strong&gt;1&lt;/strong&gt;     &lt;strong&gt; &lt;span style="color:#ff0000;"&gt;public class Hello&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;2     {&lt;br /&gt;3      /**&lt;br /&gt;4     * My first Java program&lt;br /&gt;5       */&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; Indicates the name of the class which is Hello &lt;/li&gt;&lt;li&gt;In Java, all code should be placed inside a class declaration &lt;/li&gt;&lt;li&gt;The class uses an access specifier public, which indicates that our class in accessible to other classes from other packages (packages are a collection of classes). We will be covering packages and access specifiers later. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;______________________________________________________________________&lt;/p&gt;&lt;p&gt;&lt;br /&gt;1      public class Hello&lt;br /&gt;&lt;strong&gt;2&lt;/strong&gt;    &lt;strong&gt; &lt;/strong&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;{&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;3      /**&lt;br /&gt;4         * My first Java program&lt;br /&gt;5      */ &lt;/p&gt;&lt;ul&gt;&lt;li&gt; The next line which contains a curly brace { indicates the start of a block. &lt;/li&gt;&lt;li&gt;In this code, we placed the curly brace at the next line after the class declaration, however, we can also place this next to the first line of our code. So, we could actually write our code as:&lt;br /&gt;      public class Hello&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;{&lt;/span&gt; &lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;______________________________________________________________________&lt;/p&gt;&lt;p&gt;&lt;br /&gt;1        public class Hello&lt;br /&gt;2       {&lt;br /&gt;&lt;strong&gt;3&lt;/strong&gt;       &lt;strong&gt;&lt;span style="color:#ff0000;"&gt;/**&lt;br /&gt;&lt;/span&gt;4          &lt;span style="color:#ff0000;"&gt;* My first Java program&lt;/span&gt;&lt;br /&gt;5       &lt;span style="color:#ff0000;"&gt;*/&lt;/span&gt; &lt;/strong&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; The next three lines indicates a Java comment. &lt;/li&gt;&lt;li&gt;A comment&lt;br /&gt;-something used to document a part of a code.&lt;br /&gt;-It is not part of the program itself, but used for documentation purposes.&lt;br /&gt;-It is good programming practice to add comments to your code. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;______________________________________________________________________&lt;/p&gt;&lt;p&gt;&lt;br /&gt;1     public class Hello&lt;br /&gt;2    {&lt;br /&gt;3      /**&lt;br /&gt;4      * My first Java program&lt;br /&gt;5       */&lt;br /&gt;&lt;strong&gt;6&lt;/strong&gt;       &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;public static void main( String[] args ){&lt;/strong&gt; &lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#000000;"&gt;&lt;span style="color:#000000;"&gt;I&lt;/span&gt;ndicates the name of one method in Hello which is the main method.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#000000;"&gt;The main method is the starting point of a Java program. &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#000000;"&gt;All programs except Applets written in Java start with the main method.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color:#ff0000;"&gt;&lt;span style="color:#000000;"&gt;Make sure to follow the exact signature.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color:#ff0000;"&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;______________________________________________________________________&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;1     public class Hello&lt;br /&gt;2     {&lt;br /&gt;3      /**&lt;br /&gt;4       * My first Java program&lt;br /&gt;5      */&lt;br /&gt;6       public static void main( String[] args ){&lt;br /&gt;&lt;strong&gt;7&lt;/strong&gt;          &lt;/span&gt;&lt;strong&gt;//prints the string “Hello world” on screen&lt;/strong&gt; &lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt; The 7th line is also a Java comment&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;______________________________________________________________________&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;1        public class Hello&lt;br /&gt;2        {&lt;br /&gt;3        /**&lt;br /&gt;4         * My first Java program&lt;br /&gt;5         */&lt;br /&gt;6        public static void main( String[] args ){&lt;br /&gt;7        //prints the string “Hello world” on screen&lt;br /&gt;&lt;strong&gt;8&lt;/strong&gt;&lt;/span&gt;       &lt;strong&gt;System.out.println(“Hello &lt;span style="color:#ff0000;"&gt;world”);&lt;/span&gt;&lt;/strong&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;span style="color:#000000;"&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;The command &lt;span style="color:#ff0000;"&gt;&lt;strong&gt;System.out.println(),&lt;/strong&gt;&lt;/span&gt; prints the text enclosed by quotation on the screen.&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;______________________________________________________________________&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="color:#000000;"&gt;1     public class Hello&lt;br /&gt;2     {&lt;br /&gt;3      /**&lt;br /&gt;4       * My first Java program&lt;br /&gt;5        */&lt;br /&gt;6      public static void main( String[] args ){&lt;br /&gt;7      //prints the string “Hello world” on screen&lt;br /&gt;8      System.out.println(“Hello world”);&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000000;"&gt;9 &lt;/span&gt;    }&lt;br /&gt;&lt;span style="color:#000000;"&gt;10&lt;/span&gt;   }&lt;/strong&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="color:#000000;"&gt;The last two lines which contains the two curly braces is used to close the main method and class respectively.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/analyzing-basic-program.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-6405219486677999782</guid><pubDate>Thu, 19 Feb 2009 11:46:00 +0000</pubDate><atom:updated>2009-02-19T03:56:54.557-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Basics</category><title>Basic Elements For Programing</title><description>&lt;span style="font-size:130%;color:#ff0000;"&gt;&lt;strong&gt; Sample Java Program:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1   public class Hello&lt;br /&gt;2  {&lt;br /&gt;3   /**&lt;br /&gt;4  * My first Java program&lt;br /&gt;5  */&lt;br /&gt;6             public static void main( String[] args ){&lt;br /&gt;7    //prints the string Hello world on screen&lt;br /&gt;8             System.out.println(“Hello world”);&lt;br /&gt;9    }&lt;br /&gt;10  }</description><link>http://rapidjava.blogspot.com/2009/02/basic-elements-for-programing.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-6808128399203893446</guid><pubDate>Thu, 19 Feb 2009 11:31:00 +0000</pubDate><atom:updated>2009-02-19T03:38:11.451-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>Phases of a Java Program</title><description>&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0ybQG07l2tlwT5WcbY2qUyEZrXqEU3rWmRisVGJAOA-eCJ9nqklq61sV6R84g5Vxcw8ec4w2xczq28K00IaR9v_xVWccCEQ9Ai-ovdNPQp3inhPEwJTf2ge-jy1FOaokUWDY4e_gdq-3L/s1600-h/phase+2.bmp"&gt;&lt;img id="BLOGGER_PHOTO_ID_5304471260284607890" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 102px; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0ybQG07l2tlwT5WcbY2qUyEZrXqEU3rWmRisVGJAOA-eCJ9nqklq61sV6R84g5Vxcw8ec4w2xczq28K00IaR9v_xVWccCEQ9Ai-ovdNPQp3inhPEwJTf2ge-jy1FOaokUWDY4e_gdq-3L/s400/phase+2.bmp" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGMidLD-qjZfgXTxHB8u8o_hfCicGC6MRVTVp5z1jfxLdrWYrmkD1eGN21-V1PGU8AOEzg14ki9g_fcrzq5yMJYPNqLlYVfP-Owyg-rFYsfagV_pwkKGPUBWOig5zj9j4XRNlDGnl27V_9/s1600-h/Java+Phase.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5304470644325784994" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 123px; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGMidLD-qjZfgXTxHB8u8o_hfCicGC6MRVTVp5z1jfxLdrWYrmkD1eGN21-V1PGU8AOEzg14ki9g_fcrzq5yMJYPNqLlYVfP-Owyg-rFYsfagV_pwkKGPUBWOig5zj9j4XRNlDGnl27V_9/s400/Java+Phase.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;The above figure describes the process of compiling and executing a Java program &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</description><link>http://rapidjava.blogspot.com/2009/02/phases-of-java-program.html</link><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0ybQG07l2tlwT5WcbY2qUyEZrXqEU3rWmRisVGJAOA-eCJ9nqklq61sV6R84g5Vxcw8ec4w2xczq28K00IaR9v_xVWccCEQ9Ai-ovdNPQp3inhPEwJTf2ge-jy1FOaokUWDY4e_gdq-3L/s72-c/phase+2.bmp" width="72"/><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-2014487749037900078</guid><pubDate>Thu, 19 Feb 2009 11:23:00 +0000</pubDate><atom:updated>2009-02-19T03:30:50.264-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>Java Features</title><description>&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Java Virtual Machine (JVM)‏&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;-an imaginary machine that is implemented by emulating software on a real machine.&lt;br /&gt;-provides the hardware platform specifications to which you compile all Java technology code.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Bytecode&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;-a special machine language that can be understood by the Java Virtual Machine (JVM)‏.&lt;br /&gt;-independent of any particular computer hardware, so any computer with a Java interpreter can execute the compiled Java program, no matter what type of computer the program was compiled on. &lt;blockquote&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Garbage collection thread&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;-responsible for freeing any memory that can be freed. This happens automatically during the lifetime of the Java program.&lt;br /&gt;-programmer is freed from the burden of having to deallocate that memory themselves.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Code security&lt;/strong&gt; is attained in Java through the implementation of its Java Runtime Environment (JRE).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;JRE&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;-runs code compiled for a JVM and performs class loading (through the class loader), code verification (through the bytecode verifier) and finally code execution.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Class Loader&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;-responsible for loading all classes needed for the Java program.&lt;br /&gt;-adds security by separating the namespaces for the classes of the local file system from those that are imported from network sources .&lt;br /&gt;-After loading all the classes, the memory layout of the executable is then determined. This adds protection against unauthorized access to restricted areas of the code since the memory layout is determined during runtime.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Bytecode verifier&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;-tests the format of the code fragments and checks the code fragments for illegal code that can violate access rights to objects.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/java-features.html</link><author>noreply@blogger.com (Vignesh)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5546221036099219477.post-4626095656865037993</guid><pubDate>Thu, 19 Feb 2009 11:21:00 +0000</pubDate><atom:updated>2009-02-19T03:23:10.891-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Introduction</category><title>An Application and Runtime Environment</title><description>&lt;ul&gt;&lt;li&gt; Java technology applications are typically general-purpose programs that run on any machine where the Java runtime environment (JRE) is installed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;There are two main deployment environments: &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt;               1. The JRE supplied by the Java 2 Software Development Kit (SDK) contains the complete set of class files for all the Java technology packages, which includes basic language classes, GUI component classes, and so on. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;                2. The other main deployment environment is on your web browser. Most commercial browsers supply a Java technology interpreter and runtime environment&lt;/p&gt;</description><link>http://rapidjava.blogspot.com/2009/02/application-and-runtime-environment.html</link><author>noreply@blogger.com (Vignesh)</author></item></channel></rss>