<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1237146531447248696</id><updated>2024-08-29T12:11:44.488-07:00</updated><title type='text'>Java For You</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-6340707512622348823</id><published>2012-05-19T13:07:00.000-07:00</published><updated>2012-05-19T13:21:54.315-07:00</updated><title type='text'>Program to Sort an Array</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
class sort&lt;br /&gt;
{&lt;br /&gt;
public static void main(String args[])&lt;br /&gt;
{&lt;br /&gt;
int a[ ] ={3,5,4,1,2};&lt;br /&gt;
int temp, i , j ;&lt;br /&gt;
System.out.println(&quot;The Array before Sorting :&quot;);&lt;br /&gt;
for(i=0;i&amp;lt;a.length;i++)&lt;br /&gt;
{&lt;br /&gt;
System.out.println(&quot; &quot;+a[i]);&lt;br /&gt;
}&lt;br /&gt;
for(i=0 ; i &amp;lt; a.length ; i++)&lt;br /&gt;
{&lt;br /&gt;
for(j=i+1;j&amp;lt; a.length ; j++)&lt;br /&gt;
{&lt;br /&gt;
if(a[i]&amp;gt;a[j])&lt;br /&gt;
{&lt;br /&gt;
temp = a[i];&lt;br /&gt;
a[i] = a[j];&lt;br /&gt;
a[j] = temp;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot;The Array After Sorting :&quot;);&lt;br /&gt;
for(i = 0;i&amp;lt;a.length ;i++)&lt;br /&gt;
{&lt;br /&gt;
System.out.println(&quot; &amp;nbsp;&quot;+a[i]);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/6340707512622348823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2012/05/program-to-sort-array.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/6340707512622348823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/6340707512622348823'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2012/05/program-to-sort-array.html' title='Program to Sort an Array'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-1928224268793862298</id><published>2012-05-19T12:52:00.000-07:00</published><updated>2012-05-19T12:52:34.160-07:00</updated><title type='text'>Prime Factor Program in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
class PrimeFactors&lt;br /&gt;
{&lt;br /&gt;
public static void main(String args[])&lt;br /&gt;
{&lt;br /&gt;
int num =9;&lt;br /&gt;
int i , j , flag =0;&lt;br /&gt;
System.out.println(&quot;The Prime Factors for number &quot;+num+&quot; &amp;nbsp;are :&quot;);&lt;br /&gt;
for(i=0;i&amp;lt;n;i++)&lt;br /&gt;
{&lt;br /&gt;
if(n % i == 0)&lt;br /&gt;
{&lt;br /&gt;
for(j=2;j&amp;lt;i;j++)&lt;br /&gt;
{&lt;br /&gt;
if(i%j==0)&lt;br /&gt;
{&lt;br /&gt;
flag =1;&lt;br /&gt;
break;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
flag=0;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
if(flag == 0|| i == 2)&lt;br /&gt;
{&lt;br /&gt;
System.out.println(&quot; &quot;+i);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/1928224268793862298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2012/05/prime-factor-program-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/1928224268793862298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/1928224268793862298'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2012/05/prime-factor-program-in-java.html' title='Prime Factor Program in Java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-2063417911332199529</id><published>2011-07-11T13:25:00.000-07:00</published><updated>2011-10-14T22:09:08.639-07:00</updated><title type='text'>Traffic Lights program in java</title><content type='html'>&lt;!-- Begin: adBrite, Generated: 2011-10-15 1:03:32  --&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var AdBrite_Title_Color = &#39;0000FF&#39;;
var AdBrite_Text_Color = &#39;000000&#39;;
var AdBrite_Background_Color = &#39;FFFFFF&#39;;
var AdBrite_Border_Color = &#39;CCCCCC&#39;;
var AdBrite_URL_Color = &#39;008000&#39;;
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==&#39;&#39;?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe=&#39;&#39;;var AdBrite_Referrer=&#39;&#39;;}
&lt;/script&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(&#39; src=&quot;http://ads.adbrite.com/mb/text_group.php?sid=2030155&amp;zs=3330305f323530&amp;ifr=&#39;+AdBrite_Iframe+&#39;&amp;ref=&#39;+AdBrite_Referrer+&#39;&quot; type=&quot;text/javascript&quot;&gt;&#39;);document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));&lt;/script&gt;&lt;br /&gt;
&lt;div&gt;&lt;a target=&quot;_top&quot; href=&quot;http://www.adbrite.com/mb/commerce/purchase_form.php?opid=2030155&amp;afsid=1&quot; style=&quot;font-weight:bold;font-family:Arial;font-size:13px;&quot;&gt;Your Ad Here&lt;/a&gt;&lt;/div&gt;&lt;!-- End: adBrite --&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;// This is an creative program created by me to give you the creative example of the&lt;br /&gt;
// applets in java&lt;br /&gt;
// hope you will find this program interesting&lt;br /&gt;
&lt;br /&gt;
import java.awt.*;&lt;br /&gt;
import java.applet.*;&lt;br /&gt;
import java.awt.Color.*;&lt;br /&gt;
/*&lt;br /&gt;
&amp;lt;applet code=&quot;TrafficLights&quot; width=1000 height=675&amp;gt;&lt;br /&gt;
&amp;lt;/applet&amp;gt;&lt;br /&gt;
*/&lt;br /&gt;
public class TrafficLights extends Applet&lt;br /&gt;
{&lt;br /&gt;
public int y=800;&lt;br /&gt;
public void paint(Graphics g)&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
g.drawRect(50,50,150,400);&lt;br /&gt;
g.setColor(Color.black);&lt;br /&gt;
g.fillRect(50,50,150,400);&lt;br /&gt;
g.drawRect(80,400,85,520);&lt;br /&gt;
g.setColor(Color.black);&lt;br /&gt;
g.fillRect(80,400,85,520);&lt;br /&gt;
g.drawRect(40,520,950,525);&lt;br /&gt;
g.setColor(Color.gray);&lt;br /&gt;
g.fillRect(40,520,950,525);&lt;br /&gt;
g.setColor(Color.red);&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(75,75,100,100);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.red);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(y+5,530,60,60);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y+40,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Thread.sleep(10000);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;catch(InterruptedException ie)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;try&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.drawRect(50,50,150,400);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(50,50,150,400);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.drawRect(80,400,85,520);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(80,400,85,520);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.drawRect(40,520,950,525);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.gray);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(40,520,950,525);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.yellow);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(75,225,100,100);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.red);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(y+5,530,60,60);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y+40,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Thread.sleep(5000);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;catch(InterruptedException ie)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;try&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.drawRect(50,50,150,400);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(50,50,150,400);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.drawRect(80,400,85,520);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(80,400,85,520);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.drawRect(40,520,950,525);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.gray);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(40,520,950,525);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.green);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(75,300,100,100);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;for(int i=0;i&amp;lt;80;i++)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.gray);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(y+5,530,60,60);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y+40,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;y=y-10;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.red);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillRect(y+5,530,60,60);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.setColor(Color.black);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;g.fillOval(y+40,590,30,30);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Thread.sleep(200);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Thread.sleep(10000);&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;catch(InterruptedException ie)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;OUTPUT&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&amp;nbsp;:&lt;br /&gt;
//In output you will see wheel car moving at the green light.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLPSxNjXVQmUIT9kE_gR8IF5PrWLw8OOmYzyhwRnZLmMA_4PlKMz1apNaraxL4ajpZumzMxgAFpnwwzU2idp9Z3ZkFzZbCkoDEeflfKITSFYT5aI0Q5Lig6a8TedUYYaUs3G1dejzVnzU/s1600/trafficlights.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;225&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLPSxNjXVQmUIT9kE_gR8IF5PrWLw8OOmYzyhwRnZLmMA_4PlKMz1apNaraxL4ajpZumzMxgAFpnwwzU2idp9Z3ZkFzZbCkoDEeflfKITSFYT5aI0Q5Lig6a8TedUYYaUs3G1dejzVnzU/s320/trafficlights.PNG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;script type=&quot;text/javascript&quot;&gt;
ch_fluidH = 1;
ch_nump = &quot;4&quot;;
ch_client = &quot;salil007&quot;;
ch_width = 550;
ch_height = &quot;auto&quot;;
ch_type = &quot;mpu&quot;;
ch_sid = &quot;Chitika Default&quot;;
ch_backfill = 1;
ch_color_site_link = &quot;0000cc&quot;;
ch_color_title = &quot;0000cc&quot;;
ch_color_border = &quot;ffffff&quot;;
ch_color_text = &quot;000000&quot;;
ch_color_bg = &quot;ffffff&quot;;
&lt;/script&gt;&lt;br /&gt;
&lt;script src=&quot;http://scripts.chitika.net/eminimalls/amm.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/2063417911332199529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/07/traffic-lights-program-in-java.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/2063417911332199529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/2063417911332199529'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/07/traffic-lights-program-in-java.html' title='Traffic Lights program in java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLPSxNjXVQmUIT9kE_gR8IF5PrWLw8OOmYzyhwRnZLmMA_4PlKMz1apNaraxL4ajpZumzMxgAFpnwwzU2idp9Z3ZkFzZbCkoDEeflfKITSFYT5aI0Q5Lig6a8TedUYYaUs3G1dejzVnzU/s72-c/trafficlights.PNG" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-948190109838425843</id><published>2011-07-04T12:28:00.000-07:00</published><updated>2011-07-10T00:15:39.091-07:00</updated><title type='text'>Concept of isAlive and join in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;&lt;u&gt;isAlive&lt;/u&gt;&lt;/b&gt; : This method is used to check whether a thread is in the running state or not .&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Join&lt;/u&gt;&lt;/b&gt; : This method is use to specify the time you want to wait for the specified thread to terminate .&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Example&lt;/u&gt;&lt;/b&gt; :&lt;br /&gt;
&lt;br /&gt;
class Demo&lt;br /&gt;
{&lt;br /&gt;
String arr[]={&quot;Here comes the I&#39;st child &quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;Here comes the II&#39;nd child&quot;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;Here comes the III&#39;rd child&quot;};&lt;br /&gt;
public void run()&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
for(int i=0;i&amp;lt;3;i++)&lt;br /&gt;
{&lt;br /&gt;
Thread.sleep(3000);&lt;br /&gt;
System.out.println(arr[i]);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
catch(InterruptedException e)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
class Demojoin&lt;br /&gt;
{&lt;br /&gt;
public static void main(String args[])&lt;br /&gt;
{&lt;br /&gt;
System.out.println(&quot;The School Bus is waiting for the three children at the Bus Stop&quot;);&lt;br /&gt;
Demo ob1 = new Demo();&lt;br /&gt;
Thread t = new Thread(ob1);&lt;br /&gt;
t.start();&lt;br /&gt;
while(t.isAlive()) //Here you can make out the use of isAlive concept&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
System.out.println(&quot;Still waiting ........ &quot;);&lt;br /&gt;
join(1000);&lt;br /&gt;
}&lt;br /&gt;
catch(InterrutptedException e)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot;Finally!!&quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;OUTPUT&lt;/u&gt;&lt;/b&gt; :&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs4Fiv17GJ6Af6yJjd5GzjFvG5L9LV-kHYKMm9WI6g3egGkZs7vdxBi38IRmbmSAh0zpq6op11bU4BoV_xPH71JVtOa2Wt9hYyrJHfH3a3K4BJr1H4BCLpnZtKZJTZ0jSZ1RmkKrdKbJ4/s1600/Demo.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs4Fiv17GJ6Af6yJjd5GzjFvG5L9LV-kHYKMm9WI6g3egGkZs7vdxBi38IRmbmSAh0zpq6op11bU4BoV_xPH71JVtOa2Wt9hYyrJHfH3a3K4BJr1H4BCLpnZtKZJTZ0jSZ1RmkKrdKbJ4/s1600/Demo.PNG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;a href=&quot;http://gan.doubleclick.net/gan_click?lid=41000000035939880&amp;pubid=21000000000365806&quot;&gt;&lt;img src=&quot;http://gan.doubleclick.net/gan_impression?lid=41000000035939880&amp;pubid=21000000000365806&quot; border=0 alt=&quot;AbeBooks Logo Canada&quot;&gt;&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/948190109838425843/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/07/isalive-and-join-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/948190109838425843'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/948190109838425843'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/07/isalive-and-join-in-java.html' title='Concept of isAlive and join in java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjs4Fiv17GJ6Af6yJjd5GzjFvG5L9LV-kHYKMm9WI6g3egGkZs7vdxBi38IRmbmSAh0zpq6op11bU4BoV_xPH71JVtOa2Wt9hYyrJHfH3a3K4BJr1H4BCLpnZtKZJTZ0jSZ1RmkKrdKbJ4/s72-c/Demo.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-6635010406289512532</id><published>2011-06-16T19:14:00.000-07:00</published><updated>2011-10-14T22:09:51.350-07:00</updated><title type='text'>Program to Print the sum of Rows of 2-D Array</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;class Sum&lt;br /&gt;
{&lt;br /&gt;
public static void main ( String args[ ])&lt;br /&gt;
{&lt;br /&gt;
int s[ ] = new int[3];&lt;br /&gt;
int a[ ][ ] = {{1,2,3},{3,4,5},{6,7,8}};&lt;br /&gt;
int &amp;nbsp;r, c;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;for(r=0 ; r&amp;lt;a.length ; r++)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;System.out.print( &quot;|&quot; );&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;for(c=0 ; c&amp;lt;a.length ; c++)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;System.out.print( a[r][c]+&quot; &quot;);&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;System.out.println( &quot;|&quot; );&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;for(r=0 ; r&amp;lt;a.length ; r++)&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;{&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;s[r] = 0;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;}&lt;/div&gt;for(r=0 ; r&amp;lt;a.length ; r++)&lt;br /&gt;
{&lt;br /&gt;
for(c=0 ; c&amp;lt;a.length ; c++)&lt;br /&gt;
{&lt;br /&gt;
s[r] = s[r] + a[r][c] ;&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
for(r=0 ; r&amp;lt;3 ; r++)&lt;br /&gt;
{&lt;br /&gt;
System.out.printlln(&quot;The sum of &quot;+(r+1)+&quot; row of an array is :&quot; +s[r]);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;OUTPUT&lt;/u&gt;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8zig8-KQh98o_VYWWZM37SrWSeYFSpfw_SdCTY3fVTYJ9TgCfMnUkTA5JXCN4ECIqA5VgxqqqmHD9cg6wzV9SQ1A10nMgMeXL_4iJ4GYYee7a9Swm9TOazbh9qVz7inDTbxnpDP2yn3E/s1600/sum.PNG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8zig8-KQh98o_VYWWZM37SrWSeYFSpfw_SdCTY3fVTYJ9TgCfMnUkTA5JXCN4ECIqA5VgxqqqmHD9cg6wzV9SQ1A10nMgMeXL_4iJ4GYYee7a9Swm9TOazbh9qVz7inDTbxnpDP2yn3E/s1600/sum.PNG&quot; /&gt;&lt;/a&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;/div&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;!-- Begin: adBrite, Generated: 2011-10-15 1:03:32  --&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var AdBrite_Title_Color = &#39;0000FF&#39;;
var AdBrite_Text_Color = &#39;000000&#39;;
var AdBrite_Background_Color = &#39;FFFFFF&#39;;
var AdBrite_Border_Color = &#39;CCCCCC&#39;;
var AdBrite_URL_Color = &#39;008000&#39;;
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==&#39;&#39;?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe=&#39;&#39;;var AdBrite_Referrer=&#39;&#39;;}
&lt;/script&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(&#39; src=&quot;http://ads.adbrite.com/mb/text_group.php?sid=2030155&amp;zs=3330305f323530&amp;ifr=&#39;+AdBrite_Iframe+&#39;&amp;ref=&#39;+AdBrite_Referrer+&#39;&quot; type=&quot;text/javascript&quot;&gt;&#39;);document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));&lt;/script&gt;&lt;br /&gt;
&lt;div&gt;&lt;a target=&quot;_top&quot; href=&quot;http://www.adbrite.com/mb/commerce/purchase_form.php?opid=2030155&amp;afsid=1&quot; style=&quot;font-weight:bold;font-family:Arial;font-size:13px;&quot;&gt;Your Ad Here&lt;/a&gt;&lt;/div&gt;&lt;!-- End: adBrite --&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/6635010406289512532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-print-sum-of-rows-of-2-d.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/6635010406289512532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/6635010406289512532'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-print-sum-of-rows-of-2-d.html' title='Program to Print the sum of Rows of 2-D Array'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8zig8-KQh98o_VYWWZM37SrWSeYFSpfw_SdCTY3fVTYJ9TgCfMnUkTA5JXCN4ECIqA5VgxqqqmHD9cg6wzV9SQ1A10nMgMeXL_4iJ4GYYee7a9Swm9TOazbh9qVz7inDTbxnpDP2yn3E/s72-c/sum.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-3326392334676584456</id><published>2011-06-16T09:54:00.000-07:00</published><updated>2011-06-16T09:54:19.841-07:00</updated><title type='text'>Program to Print Triangle Pattern in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;Q&lt;/b&gt;.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; * &amp;nbsp; &amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;* &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp;* &amp;nbsp; &amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Solution&lt;/u&gt; :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
class triangle&lt;br /&gt;
{&lt;br /&gt;
public static void main ( String args [ ] )&lt;br /&gt;
{&lt;br /&gt;
int &amp;nbsp;i , j , k;&lt;br /&gt;
&lt;br /&gt;
for( i =1 ; i &amp;lt; 5 ; i ++ )&lt;br /&gt;
{&lt;br /&gt;
for( j =1 ; j &amp;lt;5-i ; j++)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
for( k =i ; k &amp;gt;0 ; k--)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot;* &quot;);&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/3326392334676584456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-print-triangle-pattern-in.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/3326392334676584456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/3326392334676584456'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-print-triangle-pattern-in.html' title='Program to Print Triangle Pattern in java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-7183257406556061822</id><published>2011-06-16T09:02:00.000-07:00</published><updated>2011-06-16T09:02:44.955-07:00</updated><title type='text'>Program to Reverse a number in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;class Reverse&lt;br /&gt;
{&lt;br /&gt;
public static void main(String args[ ])&lt;br /&gt;
{&lt;br /&gt;
int rev=0; // Initializing a variable&lt;br /&gt;
int temp;&lt;br /&gt;
int n = 432;&lt;br /&gt;
while(n!=0)&lt;br /&gt;
{&lt;br /&gt;
temp = n%10;&lt;br /&gt;
rev = rev * 10 + temp ;&lt;br /&gt;
n = n/10;&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot;The Reverse of the number &quot;+n+&quot; is : &quot;+ rev);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;OUTPUT &lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
The Reverse of the number 432 is : 234&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/7183257406556061822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-reverse-number-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/7183257406556061822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/7183257406556061822'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-reverse-number-in-java.html' title='Program to Reverse a number in java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-8297443796056980349</id><published>2011-06-14T21:20:00.000-07:00</published><updated>2011-10-14T22:11:55.432-07:00</updated><title type='text'>Program to Print the Fibonacci Series in java Using Array</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;class fibonacci&lt;br /&gt;
{&lt;br /&gt;
public static void main (String args [ ])&lt;br /&gt;
{&lt;br /&gt;
int i;&lt;br /&gt;
int array[] = new int[11];&lt;br /&gt;
array[0]= -1;&lt;br /&gt;
array[1]= 1;&lt;br /&gt;
System.out.println(&quot;The fibonacci series &amp;nbsp;is : \n&quot;);&lt;br /&gt;
for(i=2 ; i&amp;lt;array.length ; i++)&lt;br /&gt;
{&lt;br /&gt;
array[i]=array[i-2] + array[i-1];&lt;br /&gt;
System.out.print(array[i]+ &quot; &quot; );&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;OUTPUT&lt;/u&gt;&lt;/b&gt; :&lt;br /&gt;
The fibonacci series is :&lt;br /&gt;
0 1 1 2 3 5 8 13 21&amp;nbsp;&lt;/div&gt;&lt;!-- Begin: adBrite, Generated: 2011-10-15 1:03:32  --&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
var AdBrite_Title_Color = &#39;0000FF&#39;;
var AdBrite_Text_Color = &#39;000000&#39;;
var AdBrite_Background_Color = &#39;FFFFFF&#39;;
var AdBrite_Border_Color = &#39;CCCCCC&#39;;
var AdBrite_URL_Color = &#39;008000&#39;;
try{var AdBrite_Iframe=window.top!=window.self?2:1;var AdBrite_Referrer=document.referrer==&#39;&#39;?document.location:document.referrer;AdBrite_Referrer=encodeURIComponent(AdBrite_Referrer);}catch(e){var AdBrite_Iframe=&#39;&#39;;var AdBrite_Referrer=&#39;&#39;;}
&lt;/script&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;document.write(String.fromCharCode(60,83,67,82,73,80,84));document.write(&#39; src=&quot;http://ads.adbrite.com/mb/text_group.php?sid=2030155&amp;zs=3330305f323530&amp;ifr=&#39;+AdBrite_Iframe+&#39;&amp;ref=&#39;+AdBrite_Referrer+&#39;&quot; type=&quot;text/javascript&quot;&gt;&#39;);document.write(String.fromCharCode(60,47,83,67,82,73,80,84,62));&lt;/script&gt;&lt;br /&gt;
&lt;div&gt;&lt;a target=&quot;_top&quot; href=&quot;http://www.adbrite.com/mb/commerce/purchase_form.php?opid=2030155&amp;afsid=1&quot; style=&quot;font-weight:bold;font-family:Arial;font-size:13px;&quot;&gt;Your Ad Here&lt;/a&gt;&lt;/div&gt;&lt;!-- End: adBrite --&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/8297443796056980349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-print-fibonacci-series-in_14.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/8297443796056980349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/8297443796056980349'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/program-to-print-fibonacci-series-in_14.html' title='Program to Print the Fibonacci Series in java Using Array'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-6313911953624532522</id><published>2011-06-06T10:24:00.000-07:00</published><updated>2011-06-18T22:30:27.301-07:00</updated><title type='text'>Triangle Pattern Program in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;Q&lt;/b&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* * *&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* * * * *&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* * * * * * *&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Solution&lt;/u&gt;&lt;/b&gt; :&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
class triangle&lt;br /&gt;
{&lt;br /&gt;
public static void main ( String args [ ])&lt;br /&gt;
{&lt;br /&gt;
for(int row=5 ; row&amp;gt;0 ; row--)&lt;br /&gt;
{&lt;br /&gt;
for(int space=0 ; space=0 ; space --)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
for(int col=9 ; col = (row*2)+1 ; col --)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot;*&quot;);&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot; &quot;);&lt;br /&gt;
} &lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/6313911953624532522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/triangle-pattern-program-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/6313911953624532522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/6313911953624532522'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/triangle-pattern-program-in-java.html' title='Triangle Pattern Program in java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1237146531447248696.post-5708109356618710002</id><published>2011-06-05T13:00:00.000-07:00</published><updated>2011-06-18T22:39:37.115-07:00</updated><title type='text'>Pattern Programs in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;Q&lt;/b&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;* &amp;nbsp; *&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * &amp;nbsp;* &amp;nbsp;* &amp;nbsp; * &amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;* &amp;nbsp; *&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Solution&lt;/u&gt;&lt;/b&gt; :&lt;br /&gt;
class pattern&lt;br /&gt;
{&lt;br /&gt;
public static void main (String args[ ])&lt;br /&gt;
{&lt;br /&gt;
for(int row=5 ; row&amp;gt;0 ; row--)&lt;br /&gt;
{&lt;br /&gt;
for(int space=0 ; space&amp;lt;r ; space--)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
for(int col=9 ; col&amp;gt;=(row*2)+1 ; col--)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot;*&quot;);&lt;br /&gt;
}&lt;br /&gt;
System.out.println( &quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
for(int row=2 ; row&amp;gt;0 ; row--)&lt;br /&gt;
{&lt;br /&gt;
for(int space=0 ; space&amp;lt;row ; space++)&lt;br /&gt;
{&lt;br /&gt;
System.out.print( &quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
for(int col=9 ; col&amp;gt;=(row*2)+1 ; col--)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot;*&quot;);&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp;&lt;a href=&quot;http://gan.doubleclick.net/gan_click?lid=41000000035939880&amp;amp;pubid=21000000000365806&quot;&gt;&lt;img alt=&quot;AbeBooks Logo Canada&quot; border=&quot;0&quot; src=&quot;http://gan.doubleclick.net/gan_impression?lid=41000000035939880&amp;amp;pubid=21000000000365806&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;Q&lt;/b&gt;. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: large;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;u&gt;Solution&lt;/u&gt;&lt;/b&gt;&lt;b&gt; :&lt;/b&gt;&lt;br /&gt;
class pattern&lt;br /&gt;
{&lt;br /&gt;
public static void main ( String args [ ] )&lt;br /&gt;
{&lt;br /&gt;
for( int row=5; row&amp;gt;0 ; row--)&lt;br /&gt;
{&lt;br /&gt;
for( int col=0; col &amp;lt; row ; col++)&lt;br /&gt;
{&lt;br /&gt;
System.out.print(&quot; &quot;);&lt;br /&gt;
}&lt;br /&gt;
System.out.println(&quot;*&quot;);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://java4u-salil.blogspot.com/feeds/5708109356618710002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/pattern-program-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/5708109356618710002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1237146531447248696/posts/default/5708109356618710002'/><link rel='alternate' type='text/html' href='http://java4u-salil.blogspot.com/2011/06/pattern-program-in-java.html' title='Pattern Programs in Java'/><author><name>Salil</name><uri>http://www.blogger.com/profile/01186374939394346858</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>