<?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-7196562259138560599</id><updated>2024-09-04T18:50:05.206+05:30</updated><category term="Factorial of a number"/><category term="Fibonacci"/><category term="Java On Linux"/><category term="Java Prime"/><category term="Java Progrmmaing"/><category term="Java basics"/><category term="Static"/><category term="java Factorial"/><title type='text'>Programming with Java</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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>51</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7196562259138560599.post-8584114726454792429</id><published>2014-06-02T12:07:00.002+05:30</published><updated>2014-06-02T12:07:41.668+05:30</updated><title type='text'>New Features in Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 3.75pt;&quot;&gt;
&lt;span style=&quot;color: #610b38; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 19.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-font-kerning: 18.0pt;&quot;&gt;New Features in Java&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 3.75pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;There are many new features that have been added
in java. There are major enhancement made in Java5, Java6 and Java7 like&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;auto-boxing&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;generics&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;var-args&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;java
annotations&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;enum&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;premain method&lt;/b&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt; line-height: 14.65pt;&quot;&gt;&amp;nbsp;etc.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 14.65pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;Most of the interviewers ask questions from this
chapter.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Do You Know ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;padding: .75pt .75pt .75pt .75pt;&quot;&gt;
  &lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;1.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;How to
  create generic class and generic method in java ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;2.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;What is
  annotation and how to create custom annotation ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;3.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;What is
  the advantage of assertion and where we should not use it ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;4.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;What is
  variable argument and what rules are defined for variable argument ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;5.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;What is
  the difference between import and static import ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;6.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;How
  autoboxing is applied in method overloading. Which concept beats autoboxing ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;!--[if !supportLists]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;7.&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: 7pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;What is
  enum type and how to specify specific value to the enum constants ?&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 51pt; margin-top: 2.25pt; text-indent: -18pt;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: darkolivegreen; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 13.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;J2SE 4 Features&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 14.65pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;The important feature of J2SE 4 is assertions.
It is used for testing.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0cm;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Assertion&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;(Java 4)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;

&lt;hr align=&quot;center&quot; noshade=&quot;&quot; size=&quot;1&quot; style=&quot;color: #d4d4d4;&quot; width=&quot;100%&quot; /&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: darkolivegreen; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 13.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;J2SE 5 Features&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 14.65pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;The important features of J2SE 5 are generics
and assertions. Others are auto-boxing, enum, var-args, static import, for-each
loop (enhanced for loop etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0cm;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;For-each loop (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Varargs (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Static Import (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Autoboxing and Unboxing (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Enum (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Covariant Return Type (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Annotation (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;color: green; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Generics (Java 5)&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;

&lt;hr align=&quot;center&quot; noshade=&quot;&quot; size=&quot;1&quot; style=&quot;color: #d4d4d4;&quot; width=&quot;100%&quot; /&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: darkolivegreen; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 13.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;JavaSE 6 Features&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 14.65pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;The important feature of JavaSE 6 is premain
method (also known as instrumentation).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0cm;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Instrumentation
     (premain method) (Java 6)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;

&lt;hr align=&quot;center&quot; noshade=&quot;&quot; size=&quot;1&quot; style=&quot;color: #d4d4d4;&quot; width=&quot;100%&quot; /&gt;

&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: darkolivegreen; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 13.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;JavaSE 7 Features&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 14.65pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;&quot;&gt;
&lt;span style=&quot;font-family: Verdana, sans-serif; font-size: 10pt;&quot;&gt;The important features of JavaSE 7 are try with
resource, catching multiple exceptions etc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style=&quot;margin-top: 0cm;&quot; type=&quot;disc&quot;&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;String
     in switch statement (Java 7)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Binary
     Literals (Java 7)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The
     try-with-resources (Java 7)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Caching
     Multiple Exceptions by single catch (Java 7)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;background: white; margin-top: 2.25pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Underscores
     in Numeric Literals (Java 7)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: darkolivegreen; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 13.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;JavaSE 8 Features&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Let’s look at 5 features that we feel are an
absolute must for you to know about:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;1.&amp;nbsp;&lt;b&gt;&lt;span style=&quot;border: none windowtext 1.0pt; mso-border-alt: none windowtext 0cm; padding: 0cm;&quot;&gt;Lambda expressions&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Even if we really didn’t want to go mainstream
here, there’s little doubt that from a developer’s perspective, the most
dominant feature of Java 8 is the new support for Lambda expressions. This
addition to the language brings Java to the forefront of functional
programming, right there with other functional JVM-based languages such as
Scala and Clojure.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: .0001pt; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;We’ve previously looked into how&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: none windowtext 1.0pt; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Helvetica; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;Java implemented Lambda
expressions&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;, and how it compared
to the approach taken by Scala. From Java’s perspective this is by far one of
the biggest additions to the language in the past decade.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;At minimum, it’s recommended you become
familiar with the Lambda syntax, especially as it relates to array and
collection operations, where Lambdas have been tightly integrated into the core
language libraries. It is highly likely that you’ll start seeing more and more
code like the snippet below in both 3rd party and within your organization’s
code.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(248, 248, 248); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Consolas; font-size: 1.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/articles/5-features-java-8-will-change#viewSource&quot; title=&quot;view source&quot;&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #a0a0a0; mso-border-alt: none windowtext 0cm; padding: 0cm; text-decoration: none; text-underline: none;&quot;&gt;view source&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(248, 248, 248); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Consolas; font-size: 1.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/articles/5-features-java-8-will-change#printSource&quot; title=&quot;print&quot;&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #a0a0a0; mso-border-alt: none windowtext 0cm; padding: 0cm; text-decoration: none; text-underline: none;&quot;&gt;print&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #a0a0a0; mso-border-alt: none windowtext 0cm; padding: 0cm; text-decoration: none; text-underline: none;&quot;&gt;?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(231, 229, 220); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: none windowtext 1.0pt; color: #5c5c5c; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;Map&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;lt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;;Person.Sex,
List&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;lt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;;Person&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;gt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;;&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;gt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;; byGender =&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Consolas; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(231, 229, 220); vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: none windowtext 1.0pt; color: #5c5c5c; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot;background: rgb(248, 248, 248); border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;roster.stream().collect(Collectors.groupingBy(Person::getGender));&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Consolas; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;* A pretty efficient way of grouping a
collection by the value of a specific class field.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;2.&amp;nbsp;&lt;b&gt;&lt;span style=&quot;border: none windowtext 1.0pt; mso-border-alt: none windowtext 0cm; padding: 0cm;&quot;&gt;Parallel operations&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;With the addition of Lambda expressions to
arrays operations, Java introduced a key concept into the language of internal
iteration. Essentially as developers we’re used to use loop operations as one
of the most basic programming idioms, right up there with if and else.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The introduction of Lambda expressions turned
that paradigm around with the actual iteration over a collection over which a
Lambda function is invoked is carried out by the core library.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;You can think of this as an extension of
iterators where the actual operation of extracting the next item from a
collection on which to operate is carried out by an iterator. An exciting
possibility opened by this design pattern is to enable operations carried out
on long arrays such as sorting, filtering and mapping to be carried out in
parallel by the framework. When dealing with server code that’s processing
lengthy collections on a continuous basis, this can lead to major throughput
improvements with relative work from your end.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: .0001pt; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Here’s the same snippet as above, but using the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: none windowtext 1.0pt; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Helvetica; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;framework’s&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;new parallel processing capabilities -&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(248, 248, 248); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Consolas; font-size: 1.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/articles/5-features-java-8-will-change#viewSource&quot; title=&quot;view source&quot;&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #a0a0a0; mso-border-alt: none windowtext 0cm; padding: 0cm; text-decoration: none; text-underline: none;&quot;&gt;view source&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(248, 248, 248); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: Consolas; font-size: 1.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/articles/5-features-java-8-will-change#printSource&quot; title=&quot;print&quot;&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #a0a0a0; mso-border-alt: none windowtext 0cm; padding: 0cm; text-decoration: none; text-underline: none;&quot;&gt;print&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;http://java.dzone.com/articles/5-features-java-8-will-change#about&quot; title=&quot;?&quot;&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #a0a0a0; mso-border-alt: none windowtext 0cm; padding: 0cm; text-decoration: none; text-underline: none;&quot;&gt;?&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(231, 229, 220); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: none windowtext 1.0pt; color: #5c5c5c; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;1.&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;ConcurrentMap&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;lt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;;Person.Sex, List&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;lt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;;Person&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;gt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;;&amp;amp;&lt;/span&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #006699; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;gt&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;; byGender =&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Consolas; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(231, 229, 220); margin-bottom: 0.0001pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: none windowtext 1.0pt; color: #5c5c5c; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;2.&lt;/span&gt;&lt;span style=&quot;background: rgb(248, 248, 248); border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;roster.parallelStream().collect(&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Consolas; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: rgb(231, 229, 220); vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: none windowtext 1.0pt; color: #5c5c5c; font-family: Consolas; font-size: 11.5pt; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;3.&lt;/span&gt;&lt;span style=&quot;background: white; border: 1pt none windowtext; font-family: Consolas; font-size: 11.5pt; padding: 0cm;&quot;&gt;Collectors.groupingByConcurrent(Person::getGender))&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Consolas; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;* It’s a fairly small change that’s required
to make this algorithm run on multiple threads.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;3.&amp;nbsp;&lt;b&gt;&lt;span style=&quot;border: none windowtext 1.0pt; mso-border-alt: none windowtext 0cm; padding: 0cm;&quot;&gt;Java + JavaScript = &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;background: white; border: none windowtext 1.0pt; color: #222222; font-family: &amp;quot;Segoe UI Symbol&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: &amp;quot;Segoe UI Symbol&amp;quot;; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;❤&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: .0001pt; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Java 8 is looking to right one of its biggest historical wrongs
– the ever growing distance between Java and JavaScript, one that has only
increased in the past few years. With this new release, Java 8 is introducing a
completely new JVM JavaScript engine – Nashorn. This engine makes unique use of
some of the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: none windowtext 1.0pt; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Helvetica; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;new
features introduced in Java 7&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #222222;&quot;&gt;such as invokeDynamic to provide JVM-level speed to
JavaScript execution right there with the likes of V8 and SpiderMonkey.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;This means that the next time you’re looking
to integrate JS into your backend, instead of setting up a node.js instance,
you can simply use the JVM to execute the code. The added bonus here is the
ability to have seamless interoperability between your Java and JavaScript code
in-process, without having to use various IPC/RPC methods to bridge the gap.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;4.&amp;nbsp;&lt;b&gt;&lt;span style=&quot;border: none windowtext 1.0pt; mso-border-alt: none windowtext 0cm; padding: 0cm;&quot;&gt;New date / time APIs&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: .0001pt; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;The complexity of the current native Java library API has been a
cause of pain for Java developers for many years. Joda time has been filling
this vacuum for years now, and with Java 8. An immediate&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #20328e; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Helvetica; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;question that arose&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;early on was why didn’t Java 8 adopt
Joda as its native time framework. Due to what was perceived as a design flaw
in Joda, Java 8 implemented its own new date / time API from scratch. The good
news is that unlike Calendar.getInstance(), the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #20328e; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Helvetica; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;new API&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;s were designed with simplicity in mind, and
clear operations to operate on manipulated values in both human readable and
machine time formats.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: .0001pt; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;background: white; color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;5.&amp;nbsp;&lt;b&gt;&lt;span style=&quot;border: none windowtext 1.0pt; mso-border-alt: none windowtext 0cm; padding: 0cm;&quot;&gt;Concurrent accumulators&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;One of the most common scenarios in concurrent
programming is updating of numeric counters accessed by multiple threads. There
have been many idioms to do this over the years, starting from synchronized
blocks (which introduce a high level of contention), to read/write locks to
AtomicInteger(s). While the last ones are more efficient, as they rely directly
on processor CAS instructions, they require a higher degree of familiarity to
implement the required semantics correctly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: .0001pt; margin-bottom: 0cm; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;With Java 8 this problem is solved at the framework level with
new concurrent&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: none windowtext 1.0pt; color: #20328e; font-family: &amp;quot;inherit&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 11.5pt; mso-bidi-font-family: Helvetica; mso-border-alt: none windowtext 0cm; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; padding: 0cm;&quot;&gt;accumulator classes&lt;/span&gt;&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;that enable you to very efficiently increase / decrease
the value of a counter in a thread safe manner. This is really a case where
it’s not a question of taste, or preference – using these new classes in your
code is really a no-brainer.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; line-height: 16.9pt; margin-bottom: 14.4pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.2pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;color: #222222; font-family: &amp;quot;Helvetica&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.5pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Are there any other language features you
think every developers should know about? Add them in the comments section.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/8584114726454792429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/8584114726454792429?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/8584114726454792429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/8584114726454792429'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2014/06/new-features-in-java.html' title='New Features in Java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-1223746522990420576</id><published>2014-01-12T19:17:00.000+05:30</published><updated>2014-01-12T19:17:27.429+05:30</updated><title type='text'>Loading JDBC drivers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;post-body&quot; id=&quot;post-9097453713212600107&quot; style=&quot;background-color: white; font-family: georgia; font-size: 17px; line-height: 34.65625px; margin: 0px; padding: 0px; text-align: justify;&quot;&gt;
&lt;span itemprop=&quot;articleBody&quot; style=&quot;margin: 0px; padding: 0px;&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;margin: 0px; padding: 0px; text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 0px; padding: 0px; text-align: center;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;u&gt;Loading JDBC drivers&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 0px; padding: 0px; text-align: center;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;I split these examples into two specific categories which are good and dumb. &lt;/span&gt;&lt;span style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr1
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[]) throws Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;Class.forName(&quot;oracle.jdbc.driver.OracleDriver&quot;);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr2
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[]) throws Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// Choosing the driver at runtime
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;Class.forName(args[0]);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr3
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[]) throws Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Choosing the driver at runtime by a temporary
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // property
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Class.forName(System.getProperty(&quot;my.driver&quot;));
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;For executing this, you should write&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;code style=&quot;background-color: whitesmoke; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: 1px solid rgb(211, 211, 211); box-shadow: rgb(245, 245, 245) 1px 1px 1px, gray 0px 0px 0px, gray 2px 1px 1px; font-size: 11pt; margin: 0px 3px; padding: 2px;&quot;&gt;java -Dmy.driver=oracle.jdbc.driver.OracleDriver dr3&lt;/code&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;The&amp;nbsp;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;-D&lt;/b&gt;&amp;nbsp;option is followed by the property name (without space) and&amp;nbsp;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;=&lt;/b&gt;followed by the driver class. Don&#39;t forget the class name. It is damn important!&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;Note:&lt;/b&gt;&amp;nbsp;The second, third and fourth ways have a common problem. Here if we aren&#39;t decisive about which driver to use and give it at runtime we need to change the URL (to connect to the database) too. Because, different drivers have different urls. So, there must be some conditional logic written which connects to the database via appropriate URL corresponding to the given class name. This becomes a bit messy. Isn&#39;t it?&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr4
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[])
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Choosing the driver at runtime by a permanent
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // property
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println(&quot;Driver loaded &quot;+System.getProperty(&quot;jdbc.drivers&quot;));
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;Well, where is the code? I&#39;ll explain, everything lies in executing the program. You should execute this in this way.&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;code style=&quot;background-color: whitesmoke; background-position: initial initial; background-repeat: initial initial; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: 1px solid rgb(211, 211, 211); box-shadow: rgb(245, 245, 245) 1px 1px 1px, gray 0px 0px 0px, gray 2px 1px 1px; font-size: 11pt; margin: 0px 3px; padding: 2px;&quot;&gt;java -Djdbc.drivers=oracle.jdbc.driver.OracleDriver dr4&lt;/code&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;Now, this loads the driver. The&amp;nbsp;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;jdbc.drivers&lt;/b&gt;&amp;nbsp;is an environment property of Java that corresponds to the JDBC drivers. The default value for this property is&amp;nbsp;&lt;i style=&quot;margin: 0px; padding: 0px;&quot;&gt;null&lt;/i&gt;. While executing, you are changing its value to the driver class name.&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;h2 style=&quot;font-family: Arial; font-size: 15pt; line-height: 1.4em; margin: 0px 0px 5px; padding: 0px 0px 5px;&quot;&gt;
3 Dumb ways&lt;/h2&gt;
&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr5
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[])
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Creating an object for the driver class
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; new oracle.jdbc.driver.OracleDriver();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;I call this dumb because, we are creating an object for this class which is absolutely unnecessary. Here is a simple question to you&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;i style=&quot;margin: 0px; padding: 0px;&quot;&gt;Why create an object for a class when you are not going to use it? If you want to load the static block of the class? Isn&#39;t it enough to load the class into the memory using Class.forName() instead of creating an object for it?&lt;/i&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr6
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[]) throws Exception
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// Using the registerDriver
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;This way is&amp;nbsp;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;double-dumb&amp;nbsp;&lt;/b&gt;because you are loading the&amp;nbsp;&lt;i style=&quot;margin: 0px; padding: 0px;&quot;&gt;driver&lt;/i&gt;&amp;nbsp;twice. Yes, the&lt;i style=&quot;margin: 0px; padding: 0px;&quot;&gt;static block&lt;/i&gt;&amp;nbsp;of the&amp;nbsp;&lt;i style=&quot;margin: 0px; padding: 0px;&quot;&gt;oracle.jdbc.driver.OracleDriver&lt;/i&gt;&amp;nbsp;already contains a call to the&amp;nbsp;&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;registerDriver()&lt;/b&gt;. The statement,&amp;nbsp;&lt;i style=&quot;margin: 0px; padding: 0px;&quot;&gt;new oracle.jdbc.driver.OracleDriver();&lt;b style=&quot;margin: 0px; padding: 0px;&quot;&gt;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;loads it into memory (therefore, static block is executed) and creates an object for the driver class and then register the driver.&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;br style=&quot;margin: 0px; padding: 0px;&quot; /&gt;&lt;pre class=&quot;code&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-left-color: rgb(211, 211, 211); border-left-style: solid; border-left-width: 1px; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; box-shadow: rgb(245, 245, 245) 4px 2px 2px 2px, rgb(211, 211, 211) 4px 2px 2px 4px, gray 4px 2px 2px 2px; font-family: &#39;Courier New&#39;; font-size: 10pt; line-height: 1.7em; margin-bottom: 10px; margin-top: 10px; overflow-x: auto; overflow-y: hidden; padding: 10px; white-space: nowrap; width: 571px;&quot;&gt;&lt;code style=&quot;border-bottom-left-radius: 0.2em; border-bottom-right-radius: 0.2em; border-top-left-radius: 0.2em; border-top-right-radius: 0.2em; border: none; box-shadow: none; font-size: 11pt; margin: 0px; padding: 0px; white-space: pre-wrap;&quot;&gt;
class dr7 extends oracle.jdbc.driver.OracleDriver
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; public static void main(String args[])
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;System.out.println(&quot;Driver is loaded.&quot;);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/1223746522990420576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/1223746522990420576?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/1223746522990420576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/1223746522990420576'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2014/01/loading-jdbc-drivers.html' title='Loading JDBC drivers'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-4469124766340387263</id><published>2013-08-25T09:31:00.003+05:30</published><updated>2013-08-25T09:40:24.882+05:30</updated><title type='text'>Simple Chat Application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;b&gt;SIMPLE CHAT APPLICATION&lt;/b&gt;&lt;br /&gt;
1.Download this file compile and run and keep the command prompt open.....&lt;br /&gt;
This is the server code....&lt;br /&gt;
&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import java.net.*;&lt;br /&gt;
class VikramServer&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public static void main (String args[]) throws Exception&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String CStr=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String UStr=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;********************* Server**********************&quot;); &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ServerSocket SS = new ServerSocket(8888);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Socket OS = SS.accept();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataInputStream Cinp =new DataInputStream(OS.getInputStream());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataInputStream Uinp =new DataInputStream(System.in);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrintStream PS = new PrintStream(OS.getOutputStream());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(true)&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; &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; &amp;nbsp; &amp;nbsp; CStr=Cinp.readLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;Client : &quot; +CStr);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(CStr.equals(&quot;exit&quot;))&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; break; &amp;nbsp; &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; System.out.print(&quot;Server : &quot;); &amp;nbsp; &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; UStr=Uinp.readLine(); &amp;nbsp; &amp;nbsp; &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; PS.println(UStr);&lt;br /&gt;
&amp;nbsp; &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; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }catch(Exception e){System.err.println(e);};&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
2.Download this file compile and run and keep the command prompt open.....&lt;/div&gt;
This is the Client code ....&lt;br /&gt;
&lt;br /&gt;
import java.io.*;&lt;br /&gt;
import java.net.*;&lt;br /&gt;
class VikramClient&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public static void main(String args[]) throws Exception&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String Schat=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String Sstr=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Socket SC = new Socket(&quot;localhost&quot;,8888);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataInputStream Uinp =new DataInputStream(System.in);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataInputStream Sinp =new DataInputStream(SC.getInputStream());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrintStream PS = new PrintStream(SC.getOutputStream());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;********************* Client**********************&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while(true)&lt;br /&gt;
&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; &amp;nbsp; &amp;nbsp; System.out.print(&quot;Client : &quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Schat=Uinp.readLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(Schat.equals(&quot;exit&quot;))&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; break;&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; PS.println(Schat); &amp;nbsp; &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; Sstr=Sinp.readLine();&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; System.out.println(&quot;Server : &quot;+Sstr);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }catch(Exception e){System.err.println(e);}; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/4469124766340387263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/4469124766340387263?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4469124766340387263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4469124766340387263'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/08/simple-chat-application.html' title='Simple Chat Application'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-7135960032288156569</id><published>2013-07-11T22:38:00.001+05:30</published><updated>2013-07-11T22:38:18.946+05:30</updated><title type='text'>Predict the Output !!!!!</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;Public class Vikram&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;public static void main(String[] args)&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;{&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;a href=&quot;http://vikram-programmingwithjava.blogspot.in/&quot; rel=&quot;nofollow nofollow&quot; style=&quot;background-color: white; color: #3b5998; cursor: pointer; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;http://&lt;wbr&gt;&lt;/wbr&gt;&lt;span class=&quot;word_break&quot; style=&quot;display: inline-block;&quot;&gt;&lt;/span&gt;vikram-programmingwithjava.blog&lt;wbr&gt;&lt;/wbr&gt;&lt;span class=&quot;word_break&quot; style=&quot;display: inline-block;&quot;&gt;&lt;/span&gt;spot.in/&lt;/a&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;System.out.println(&quot;Why is the URL allowed above?&quot;);&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;}&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;Will the Program Compile ???&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;If Yes what would be the Output and will&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://vikram-programmingwithjava.blogspot.in/&quot; rel=&quot;nofollow nofollow&quot; style=&quot;background-color: white; color: #3b5998; cursor: pointer; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;http://&lt;wbr&gt;&lt;/wbr&gt;&lt;span class=&quot;word_break&quot; style=&quot;display: inline-block;&quot;&gt;&lt;/span&gt;vikram-programmingwithjava.blog&lt;wbr&gt;&lt;/wbr&gt;&lt;span class=&quot;word_break&quot; style=&quot;display: inline-block;&quot;&gt;&lt;/span&gt;spot.in/&lt;/a&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;&amp;nbsp;be displayed&amp;nbsp;in screen ?&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;If No what is the error in the program ???&lt;/span&gt;&lt;br style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot; /&gt;&lt;span style=&quot;background-color: white; color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 13px; line-height: 17px;&quot;&gt;Post your answers below.........&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/7135960032288156569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/7135960032288156569?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/7135960032288156569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/7135960032288156569'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/07/predict-output.html' title='Predict the Output !!!!!'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-3461553136466021744</id><published>2013-03-28T08:53:00.001+05:30</published><updated>2013-03-28T08:53:42.271+05:30</updated><title type='text'>Program to find maximum and minimum number for a n*n matrix</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
import java.io.*;&lt;br /&gt;
&amp;nbsp;class test&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;public static void main(String[] asd)throws IOException&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;BufferedReader obj=new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;
&amp;nbsp;System.out.println(&quot;Enter the values of Rows and Columns of Matrix.&quot;);&lt;br /&gt;
&amp;nbsp;String num=obj.readLine();&lt;br /&gt;
&amp;nbsp;int r=Integer.parseInt(num);&lt;br /&gt;
&amp;nbsp;num=obj.readLine();&lt;br /&gt;
&amp;nbsp;int c=Integer.parseInt(num);&lt;br /&gt;
&amp;nbsp;int m[][]= new int[r][c];&lt;br /&gt;
&amp;nbsp;int max=0, min=0;&lt;br /&gt;
&amp;nbsp;System.out.println(&quot;Enter the values of the matrix not more then &quot;+(r*c)+&quot;.&quot;);&lt;br /&gt;
&amp;nbsp;for(int i=0;i&amp;lt;r;i++)&lt;br /&gt;
&amp;nbsp;for(int j=0;j&amp;lt;c;j++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;num=obj.readLine();&lt;br /&gt;
&amp;nbsp;m[i][j]=Integer.parseInt(num);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;System.out.println(&quot;Original matrix::&quot;);&lt;br /&gt;
&amp;nbsp;for(int i=0;i&amp;lt;r;i++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;for(int j=0;j&amp;lt;c;j++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;System.out.print(m[i][j]+&quot; &quot;);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;System.out.println();&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;// MAXIMUM element of the matrix max=m[0][0];&lt;br /&gt;
&amp;nbsp;for(int i=0;i&amp;lt;r;i++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;for(int j=0;j&amp;lt;c;j++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;if(m[i][j]&amp;gt;max) max=m[i][j];&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
System.out.println(&quot;Maximum of the matrix is &quot;+max+&quot;.&quot;);&lt;br /&gt;
//MINIMUM element of the matrix min=m[0][0];&lt;br /&gt;
&amp;nbsp;for(int i=0;i&amp;lt;r;i++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;for(int j=0;j&amp;lt;c;j++)&lt;br /&gt;
&amp;nbsp;{&lt;br /&gt;
&amp;nbsp;if(m[i][j]&amp;lt;min) min=m[i][j];&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;System.out.println(&quot;Minimum of the matrix is &quot;+min+&quot;.&quot;);&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/3461553136466021744/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/3461553136466021744?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3461553136466021744'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3461553136466021744'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/03/program-to-find-maximum-and-minimum.html' title='Program to find maximum and minimum number for a n*n matrix'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-7335598405514904705</id><published>2013-03-27T18:21:00.001+05:30</published><updated>2013-03-27T18:21:16.063+05:30</updated><title type='text'>Four different ways to create an object in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;background: white; margin-bottom: .0001pt; margin-bottom: 0in; mso-line-height-alt: 9.0pt; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 1pt none windowtext; font-family: inherit, serif; font-size: 10pt; padding: 0in;&quot;&gt;1. Using new keyword&lt;br /&gt;
This is the most common way to create an object in java. I read somewhere that
almost 99% of objects are created in this way.&lt;br /&gt;
MyObject object = new MyObject();&lt;br /&gt;
2. Using Class.forName()&lt;br /&gt;
If we know the name of the class &amp;amp; if it has a public default constructor
we can create an object in this way.&lt;br /&gt;
MyObject object = (MyObject)
Class.forName(&quot;subin.rnd.MyObject&quot;).newInstance();&lt;br /&gt;
3. Using clone()&lt;br /&gt;
The clone() can be used to create a copy of an existing object.&lt;br /&gt;
MyObject anotherObject = new MyObject();&lt;br /&gt;
MyObject object = anotherObject.clone();&lt;br /&gt;
4. Using object deserialization&lt;br /&gt;
Object deserialization is nothing but creating an object from its serialized
form.&lt;br /&gt;
ObjectInputStream inStream = new ObjectInputStream(anInputStream );&lt;br /&gt;
MyObject object = (MyObject) inStream.readObject();&lt;/span&gt;&lt;span style=&quot;font-family: inherit, serif; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/7335598405514904705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/7335598405514904705?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/7335598405514904705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/7335598405514904705'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/03/four-different-ways-to-create-object-in.html' title='Four different ways to create an object in java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-8538681639019875434</id><published>2013-03-19T09:29:00.005+05:30</published><updated>2013-03-19T09:29:50.423+05:30</updated><title type='text'>How To Create A War File In Netbeans</title><content type='html'>&lt;br /&gt;
&lt;br /&gt;


&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444; font-family: Arial, sans-serif; font-size: 10.5pt;&quot;&gt;Right
click on your project name in the Explorer&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444; font-family: Arial, sans-serif; font-size: 10.5pt;&quot;&gt;Select Properties&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444; font-family: Arial, sans-serif; font-size: 10.5pt;&quot;&gt;In the Build | Packaging section, check &quot;Compress War file&quot; option.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #444444; font-family: Arial, sans-serif; font-size: 10.5pt;&quot;&gt;Select
file/folder and select your project then u can see war file in dist folder&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span style=&quot;color: #444444; font-family: Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/8538681639019875434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/8538681639019875434?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/8538681639019875434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/8538681639019875434'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/03/how-to-create-war-file-in-netbeans.html' title='How To Create A War File In Netbeans'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-6492068187031012471</id><published>2013-02-01T18:04:00.000+05:30</published><updated>2013-02-01T18:04:06.340+05:30</updated><title type='text'>Login with Swings</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Create a Login form and Index form with netbeans ide and inside Login form you can put two labels Name and password with a jTextField1 and jPasswordField1 and two buttons Submit and Cancel&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;Login&lt;/b&gt;&lt;/div&gt;
&lt;b&gt;Submit&lt;/b&gt; &lt;br /&gt;
&amp;nbsp; private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String s=jTextField1.getText();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String s1=jPasswordField1.getText();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Index i=new Index(); &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; if(s.equals(&quot;Vikram&quot;)&amp;amp;&amp;amp;s1.equals(&quot;vikram&quot;))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i.setVisible(true);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if(!&quot;Vicky&quot;.equals(s))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JOptionPane.showMessageDialog(this,&quot;User Name Is Incorrect&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&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;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; JOptionPane.showMessageDialog(this,&quot;Password Is Incorrect&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;Cancel&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; System.exit(0);&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;Index&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Date can be set to the textfield using the below code :&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; private void formWindowActivated(java.awt.event.WindowEvent evt)&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Date d=new Date();&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SimpleDateFormat da=new SimpleDateFormat(&quot;dd/MM/yyyy&quot;);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jTextField1.setText(da.format(d));&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SimpleDateFormat vi=new SimpleDateFormat(&quot;hh:mm:ss&quot;);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; jTextField2.setText(vi.format(d));&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;div style=&quot;font-weight: bold;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-weight: bold; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/6492068187031012471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/6492068187031012471?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/6492068187031012471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/6492068187031012471'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/02/login-with-swings.html' title='Login with Swings'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-4484170210071460191</id><published>2013-02-01T17:47:00.002+05:30</published><updated>2013-02-01T17:47:35.485+05:30</updated><title type='text'>Jsp connection with mysql database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Create a folder named &lt;b&gt;user&lt;/b&gt; inside your web server (Tomcat) C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps and inside the user create &lt;b&gt;WEB-INF &lt;/b&gt;and&lt;b&gt; META-INF &lt;/b&gt;so that you can create a file&amp;nbsp;inside&amp;nbsp;&lt;b&gt;META-INF &lt;/b&gt;&amp;nbsp;named&amp;nbsp;&lt;b&gt;Content.xml&amp;nbsp;&lt;/b&gt;&amp;nbsp;and you need to create a empty folder&amp;nbsp;&lt;b&gt;WEB-INF &lt;/b&gt;&amp;nbsp;and you can create and place the file &lt;b&gt;test.jsp &lt;/b&gt;inside C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\user&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Content.xml&lt;/b&gt;&lt;br /&gt;
&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Context antiJARLocking=&quot;true&quot; path=&quot;/user&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;test.jsp&lt;/b&gt;&lt;br /&gt;
&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&lt;br /&gt;
&quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ page import=&quot;java.sql.*&quot; %&amp;gt;&lt;br /&gt;
&amp;lt;%@ page import=&quot;java.io.*&quot; %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Connection with mysql database&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;h1&amp;gt;Connection status &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%&lt;br /&gt;
String connectionURL = &quot;jdbc:mysql://localhost:3306/usermaster&quot;;&lt;br /&gt;
Connection connection = null;&lt;br /&gt;
ResultSet rst=null;&lt;br /&gt;
Statement st=null;&lt;br /&gt;
&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
Class.forName(&quot;com.mysql.jdbc.Driver&quot;).newInstance();&lt;br /&gt;
connection = DriverManager.getConnection(connectionURL, &quot;root&quot;, &quot;a&quot;);&lt;br /&gt;
st = connection.createStatement();&lt;br /&gt;
}&lt;br /&gt;
catch(Exception e)&lt;br /&gt;
{&lt;br /&gt;
System.out.println(e.getMessage());&lt;br /&gt;
}&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(request.getParameter(&quot;action&quot;) != null)&lt;br /&gt;
{&lt;br /&gt;
String un=request.getParameter(&quot;un&quot;);&lt;br /&gt;
String pw=request.getParameter(&quot;pwd&quot;);&lt;br /&gt;
rst=st.executeQuery(&quot;select * from login&quot;);&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Login/h2&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;table border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;User name&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;td&amp;gt;&amp;lt;b&amp;gt;Password&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt; &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;%&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;while(rst.next()){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;%&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt; &amp;nbsp;&amp;lt;td&amp;gt;&amp;lt;%=rst.getString(&quot;un&quot;)%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt; &amp;nbsp;&amp;lt;td&amp;gt; &amp;lt;%=rst.getString(&quot;pwd&quot;)%&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&amp;lt;%&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
rst.close();&lt;br /&gt;
st.close();&lt;br /&gt;
connection.close();&lt;br /&gt;
&lt;br /&gt;
%&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
Please provide feedback readers.&lt;br /&gt;
Thank you&lt;br /&gt;
Vikram.S&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/4484170210071460191/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/4484170210071460191?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4484170210071460191'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4484170210071460191'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2013/02/jsp-connection-with-mysql-database.html' title='Jsp connection with mysql database'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-4504861148520632396</id><published>2012-10-31T18:23:00.000+05:30</published><updated>2012-10-31T18:23:34.187+05:30</updated><title type='text'>EMBED APPLETS IN HTML</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table align=&quot;center&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; style=&quot;font-family: arial, verdana, helvetica; width: 520px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;main&quot; style=&quot;font-size: 15px;&quot;&gt;&lt;div align=&quot;left&quot;&gt;
&lt;img alt=&quot;&quot; height=&quot;8&quot; src=&quot;http://www.echoecho.com/p.gif&quot; width=&quot;1&quot; /&gt;&lt;br /&gt;&lt;span class=&quot;text&quot; style=&quot;font-family: arial, helvetica; font-size: 14px;&quot;&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;W&lt;/span&gt;hen you put an applet on your page you will need to save the applet on your server as well as the HTML page the applet is embedded in. When the page is loaded by a visitor the applet will be loaded and inserted on the page where you embedded it.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;A&lt;/span&gt;pplets have the file extension &quot;&lt;span class=&quot;style2&quot;&gt;class&lt;/span&gt;&quot;. An example would be &quot;&lt;span class=&quot;style2&quot;&gt;myapplet.class&lt;/span&gt;&quot;. Some applets consist of more than just one class file, and often other files need to be present for the applet to run (such as JPG or GIF images used by the applet). Make sure to check the documentation for the applet to see if you have all files for it to run.&lt;br /&gt;Before embedding an applet on your page you need to upload the required files to your server.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;B&lt;/span&gt;elow is a short example showing how simple it is to embed an applet on a page.&lt;br /&gt;&lt;br /&gt;&lt;table align=&quot;center&quot; bgcolor=&quot;#000000&quot; border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#99aa99&quot;&gt;&lt;table bgcolor=&quot;#000000&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;1&quot; style=&quot;width: 450px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&amp;lt;Html&amp;gt;&lt;br /&gt;&amp;lt;Head&amp;gt;&lt;br /&gt;&amp;lt;Title&amp;gt;Java Example&amp;lt;/Title&amp;gt;&lt;br /&gt;&amp;lt;/Head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;Body&amp;gt;&lt;br /&gt;This is my page&amp;lt;br&amp;gt;&lt;br /&gt;Below you see an applet&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;Applet Code=&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;&quot;MyApplet.class&quot;&lt;/span&gt;&amp;nbsp;width=&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;200&lt;/span&gt;&amp;nbsp;Height=&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;100&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;/Applet&amp;gt;&lt;br /&gt;&amp;lt;/Body&amp;gt;&lt;br /&gt;&amp;lt;/Html&amp;gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;T&lt;/span&gt;wo HTML tags are relevant according to applets:&amp;nbsp;&lt;span class=&quot;style2&quot;&gt;&amp;lt;Applet&amp;gt;&lt;/span&gt;&amp;nbsp;and&amp;nbsp;&lt;span class=&quot;style2&quot;&gt;&amp;lt;Param&amp;gt;&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;T&lt;/span&gt;he&amp;nbsp;&lt;span class=&quot;style2&quot;&gt;&amp;lt;Applet&amp;gt;&lt;/span&gt;&amp;nbsp;tag embeds the applet in your HTML page.&lt;br /&gt;The&amp;nbsp;&lt;span class=&quot;style2&quot;&gt;&amp;lt;Param&amp;gt;&lt;/span&gt;&amp;nbsp;tag is used to enter parameters for the applet.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;T&lt;/span&gt;he following attributes can be set for the&amp;nbsp;&lt;span class=&quot;style2&quot;&gt;&amp;lt;Applet&amp;gt;&lt;/span&gt;&amp;nbsp;tag:&lt;br /&gt;&lt;br /&gt;&lt;table align=&quot;center&quot; bgcolor=&quot;#000000&quot; border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#99aa99&quot;&gt;&lt;table bgcolor=&quot;#000000&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;1&quot; style=&quot;width: 450px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;table8&quot; style=&quot;background-color: #eeeeee; font-size: 12px;&quot;&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 18px;&quot;&gt;&lt;/span&gt;Attribute&lt;/td&gt;&lt;td class=&quot;table8&quot; style=&quot;background-color: #eeeeee; font-size: 12px;&quot;&gt;Explanation&lt;/td&gt;&lt;td class=&quot;table8&quot; style=&quot;background-color: #eeeeee; font-size: 12px;&quot;&gt;Example&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Code&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Name of class file&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Code=&quot;myapplet.class&quot;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Width=n&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;n=Width of applet&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Width=200&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Height=n&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;n=Height of applet&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Height=100&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Codebase&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Library where the applet is stored.&lt;br /&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;If the applet is in same directory as&lt;br /&gt;your page this can be omitted.&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Codebase=&quot;applets/&quot;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Alt=&quot;Text&quot;&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Text that will be shown in browsers where the ability to show applets has been turned off.&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;alt=&quot;Menu Applet&quot;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Name=Name&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Assigning a name to an applet can&lt;br /&gt;be used when applets should&lt;br /&gt;communicate with each other.&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Name=&quot;starter&quot;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Align=&lt;br /&gt;Left&lt;br /&gt;Right&lt;br /&gt;Top&lt;br /&gt;Texttop&lt;br /&gt;Middle&lt;br /&gt;Absmiddle&lt;br /&gt;Baseline&lt;br /&gt;Bottom&lt;br /&gt;Absbottom&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Justifies the applet according to the&lt;br /&gt;text and images surrounding it.&lt;br /&gt;&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Align=Right&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Vspace=n&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Space over and under the applet.&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Vspace=20&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;Hspace=n&lt;/span&gt;&lt;/td&gt;&lt;td class=&quot;table5&quot; style=&quot;background-color: white; font-size: 12px;&quot;&gt;Space to the left and right of applet.&lt;/td&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;Hspace=40&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;T&lt;/span&gt;he&amp;nbsp;&lt;span class=&quot;style2&quot;&gt;&amp;lt;Param&amp;gt;&lt;/span&gt;&amp;nbsp;tag has the general syntax:&lt;br /&gt;&lt;table align=&quot;center&quot; bgcolor=&quot;#000000&quot; border=&quot;0&quot; cellpadding=&quot;3&quot; cellspacing=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#99aa99&quot;&gt;&lt;table bgcolor=&quot;#000000&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; cellspacing=&quot;1&quot; style=&quot;width: 450px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;table1&quot; style=&quot;background-color: #dddddd; color: #222222; font-family: Courier, &#39;Courier New&#39;, arial, helvetica; font-size: 11px;&quot;&gt;&amp;lt;Param Name=NameOfParameter Value=&lt;span class=&quot;style1&quot; style=&quot;color: #aa0000;&quot;&gt;&quot;ValueOfParameter&quot;&lt;/span&gt;&amp;gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;fancyfirst&quot; style=&quot;font-family: times, &#39;times new roman&#39;; font-size: 21px;&quot;&gt;E&lt;/span&gt;ach applet has different parameters that should be set.&lt;br /&gt;Typical parameters for an applet would be:&lt;br /&gt;&lt;ul&gt;
&lt;li&gt;color used by the applet&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;font and font size to be used on text in the applet&lt;/li&gt;
&lt;br /&gt;
&lt;li&gt;name of an image file to be inserted in the applet&lt;/li&gt;
&lt;/ul&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/4504861148520632396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/4504861148520632396?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4504861148520632396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4504861148520632396'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/10/embed-applets-in-html.html' title='EMBED APPLETS IN HTML'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-4994645777075651377</id><published>2012-10-16T16:20:00.003+05:30</published><updated>2012-10-16T16:20:14.293+05:30</updated><title type='text'>Top 8 Java People You Should Know</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
8. Tomcat &amp;amp; Ant Founder&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;James-Duncan-Davidson&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/James-Duncan-Davidson-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;James-Duncan-Davidson&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;James Duncan Davidson&lt;/span&gt;, while he was software engineer at Sun Microsystems (1997–2001), created Tomcat Java-based web server, still widely use in most of the Java web projects, and also Ant build tool, which uses XML to describe the build process and its dependencies, which is still the de facto standard for building Java-based Web applications.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://twitter.com/duncan&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;James Duncan Davidson Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/James_Duncan_Davidson&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;James Duncan Davidson Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://blog.duncandavidson.com/about/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;James Duncan Davidson personal blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://ant.apache.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Apache Ant&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://tomcat.apache.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Apache Tomcat&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;div style=&quot;margin: 20px 0px;&quot;&gt;
&lt;ins style=&quot;border: none; display: inline-table; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;ins id=&quot;aswift_1_anchor&quot; style=&quot;border: none; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;90&quot; hspace=&quot;0&quot; id=&quot;aswift_1&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_1&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;728&quot;&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
7. Test Driven Development &amp;amp; JUnit Founder&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;Kent-Beck&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/Kent-Beck-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;Kent-Beck&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;Kent Beck&lt;/span&gt;, creator of the Extreme Programming and Test Driven Development software development methodologies. Furthermore, he and Erich Gamma created JUnit, a simple testing framework, which turn into the de facto standard for testing Java-based Web applications. The combine of JUnit and Test Driven Development makes a big changed on the way of coding Java, which causes many Java developers are not willing to follow it.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://twitter.com/kentbeck&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Kent Beck Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Kent_Beck&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Kent Beck Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.threeriversinstitute.org/blog/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Kent Beck Blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.junit.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JUnit Testing Framework&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Extreme_Programming&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Extreme Programming Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Test_Driven_Development&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Test Driven Development Wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.zdnet.com/blog/burnette/kent-beck-we-thought-we-were-just-programming-on-an-airplane/118&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Kent Beck: “We thought we were just programming on an airplane”&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.informit.com/articles/article.aspx?p=20972&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Interview with Kent Beck and Martin Fowler&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://accu.org/index.php/journals/509&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;eXtreme Programming An interview with Kent Beck&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Kent Beck Books&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0321278658?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0321278658&quot; style=&quot;color: #0f3b68;&quot;&gt;Extreme Programming Explained: Embrace Change (2nd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0201485672?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0201485672&quot; style=&quot;color: #0f3b68;&quot;&gt;Refactoring: Improving the Design of Existing Code&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0596007434?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0596007434&quot; style=&quot;color: #0f3b68;&quot;&gt;JUnit Pocket Guide&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
6. Java Collections Framework&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;Joshua-Bloch&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/Joshua-Bloch-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;Joshua-Bloch&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;Joshua Bloch&lt;/span&gt;, led the design and implementation of numerous Java platform features, including JDK 5.0 language enhancements and the award-winning Java Collections Framework. In June 2004 he left Sun and became Chief Java Architect at Google. Furthermore, he won the prestigious Jolt Award from Software Development Magazine for his book, “Effective Java”, which is arguably a must read Java’s book.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://twitter.com/joshbloch&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Joshua Bloch Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Joshua_Bloch&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Joshua Bloch Wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/articles/effective-java-an-interview-wi&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Effective Java: An Interview with Joshua Bloch&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://java.sun.com/javaone/sf/2007/articles/rockstar_bloch.jsp&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Rock Star Josh Bloch&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Joshua Bloch Books&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0321356683?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0321356683&quot; style=&quot;color: #0f3b68;&quot;&gt;Effective Java (2nd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0321349601?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0321349601&quot; style=&quot;color: #0f3b68;&quot;&gt;Java Concurrency in Practice&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
5. JBoss Founder&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;Marc-Fleury&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/Marc-Fleury-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;Marc-Fleury&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;Marc Fleury&lt;/span&gt;, who founded JBoss in 2001, an open-source Java application server, arguably the de facto standard for deploying Java-based Web applications. Later he sold the JBoss to RedHat, and joined RedHat to continue support on the JBoss development. On 9 February 2007, he decided to leave Red Hat to pursue other personal interests, such as teaching, research in biology, music and his family.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Marc_Fleury&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Marc Fleury Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.thedelphicfuture.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Marc Fleury Blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.jboss.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JBoss Application Server&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://news.cnet.com/Could-Red-Hat-lose-JBoss-founder/2100-7344_3-6147300.html&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Could Red Hat lose JBoss founder?&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.zdnet.com/blog/burnette/jboss-founder-marc-fleury-leaves-red-hat-now-what/258&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JBoss founder Marc Fleury leaves Red Hat, now what?&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.zdnet.com/blog/gardner/jbosss-marc-fleury-on-soa-esb-and-oss/2300&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JBoss’s Marc Fleury on SOA, ESB and OSS&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://news.cnet.com/8301-13505_3-9753687-16.html&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Resurrecting Marc Fleury&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
4. Struts Founder&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;Craig-McClanahan&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/Craig-McClanahan-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;Craig-McClanahan&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;Craig Mcclanahan&lt;/span&gt;, creator of Struts, a popular open source MVC framework for building Java-based web applications, which is arguably that every Java developer know how to code Struts. With the huge success of Struts in early day, it’s widely implemented in every single of the old Java web application project.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Craig_McClanahan&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Craig Mcclanahan Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://blogs.sun.com/craigmcc/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Craig Mcclanahan Blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://struts.apache.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Apache Struts&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.jsfcentral.com/articles/mcclanahan-05-05.html&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Interview with Craig McClanahan&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://blogs.sun.com/craigmcc/date/20040927#struts_or_jsf_struts_and&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Struts Or JSF?&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
3. Spring Founder&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;Rod-Johnson&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/Rod-Johnson-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;Rod-Johnson&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;Rod Johnson&lt;/span&gt;, is the founder of the Spring Framework, an open source application framework for Java, Creator of Spring, CEO at SpringSource. Furthermore, Rod’s best-selling Expert One-on-One J2EE Design and Development (2002) was one of the most influential books ever published on J2EE.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://twitter.com/springrod&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Rod Johnson Twitter&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://blog.springsource.com/author/rodj/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Rod Johnson Blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.springsource.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;SpringSource&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Spring_Framework&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Spring Framework Wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://blogs.vmware.com/console/2009/08/vmware-acquires-springsource.html&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;VMware.com : VMware to acquire SpringSource&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://blog.springsource.com/2009/08/10/springsource-chapter-two/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Rod Johnson : VMware to acquire SpringSource&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://howsoftwareisbuilt.com/2007/09/10/interview-with-rod-johnson-ceo-interface21/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Interview with Rod Johnson – CEO – Interface21&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/news/qa-with-rod-johnson-over-sprin&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Q&amp;amp;A with Rod Johnson over Spring’s maintenance policy changes&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.theserverside.com/news/1364653/Expert-One-on-One-J2EE-Design-and-Development-Interview-with-Rod-Johnson&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Expert One-on-One J2EE Design and Development: Interview with Rod Johnson&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Rod Johnson Books&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0764543857?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0764543857&quot; style=&quot;color: #0f3b68;&quot;&gt;Expert One-on-One J2EE Design and Development (Programmer to Programmer)&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/0764558315?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0764558315&quot; style=&quot;color: #0f3b68;&quot;&gt;Expert One-on-One J2EE Development without EJB&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
2. Hibernate Founder&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;gravin-king&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/gravin-king-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;gravin-king&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;Gavin King&lt;/span&gt;, is the founder of the Hibernate project, a popular object/relational persistence solution for Java, and the creator of Seam, an application framework for Java EE 5. Furthermore, he contributed heavily to the design of EJB 3.0 and JPA.&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://relation.to/Bloggers/Gavin&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Gavin King Blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Hibernate_%28Java%29&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Hibernate Wiki&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.hibernate.org/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Hibernate Framework&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.jboss.com/products/seam/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JBoss seam&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://java.dzone.com/videos/gavin-king-jsr299&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Tech Chat: Gavin King on Contexts and Dependency Injection, Weld, Java EE 6&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.javaperformancetuning.com/news/interview041.shtml&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JPT : The Interview: Gavin King, Hibernate&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://javafree.uol.com.br/artigo/871462/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;JavaFree : Interview with Gavin King, founder of Hibernate&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.jsfcentral.com/articles/king-06-08.html&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Seam in Depth with Gavin King&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Gavin King Books&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/1932394885?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1932394885&quot; style=&quot;color: #0f3b68;&quot;&gt;Java Persistence with Hibernate&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.amazon.com/gp/product/193239415X?ie=UTF8&amp;amp;tag=progrlife-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=193239415X&quot; style=&quot;color: #0f3b68;&quot;&gt;Hibernate in Action (In Action series)&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 24px; line-height: 36px; margin: 50px 0px 4px; text-rendering: optimizelegibility;&quot;&gt;
1. Father of the Java programming language&lt;/h4&gt;
&lt;div class=&quot;left-pic&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;img alt=&quot;James-Gosling&quot; height=&quot;150&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2010/08/James-Gosling-150.png&quot; style=&quot;border: 0px; height: auto; max-width: 100%; vertical-align: middle;&quot; title=&quot;James-Gosling&quot; width=&quot;150&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;span class=&quot;featured-people-name&quot;&gt;James Gosling&lt;/span&gt;, generally credited as the inventor of the Java programming language in 1994. He created the original design of Java and implemented its original compiler and virtual machine. For this achievement he was elected to the United States National Academy of Engineering. On April 2, 2010, he left Sun Microsystems which had recently been acquired by the Oracle Corporation. Regarding why he left, Gosling wrote on his blog that “Just about anything I could say that would be accurate and honest would do more harm than good.”&lt;/div&gt;
&lt;div class=&quot;clearboth&quot; style=&quot;background-color: white; clear: both; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;Related Links&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://nighthacks.com/roller/jag/&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;James Gosling Blog&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/James_Gosling&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;James Gosling Wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
&lt;strong&gt;News &amp;amp; Interviews&lt;/strong&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 12px 36px; padding: 0px;&quot;&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.gotw.ca/publications/c_family_interview.htm&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Interview with Dennis Ritchie, Bjarne Stroustrup, and James Gosling&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://itmanagement.earthweb.com/osrc/article.php/3706426/Interview-James-Gosling-the-Father-of-Java.htm&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Interview: James Gosling, ‘the Father of Java’&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;line-height: 1.5;&quot;&gt;&lt;a href=&quot;http://www.builderau.com.au/program/java/soa/Developer-Interview-James-Gosling/0,339024620,320282876,00.htm&quot; style=&quot;color: #0f3b68;&quot; target=&quot;_blank&quot;&gt;Developer Interview: James Gosling&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&quot;note&quot; style=&quot;background-color: #e6e6fc; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(209, 209, 232); color: #3c3c3c; font-family: Arial, sans-serif; font-size: 14px; line-height: 21px; margin: 20px 0px; padding: 20px;&quot;&gt;
&lt;strong&gt;Note&lt;/strong&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/4994645777075651377/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/4994645777075651377?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4994645777075651377'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4994645777075651377'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/10/top-8-java-people-you-should-know_16.html' title='Top 8 Java People You Should Know'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-3776667041165567305</id><published>2012-10-02T12:10:00.002+05:30</published><updated>2012-10-02T12:10:12.813+05:30</updated><title type='text'>Oracle 11g Release 2 Installation Steps</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 15px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol start=&quot;1&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The Oracle Database 11g Release 2 files are broken down into two zip files on the Oracle site. That means you need to download both files, and then expand them into an installation directory. I called my installation directory&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px;&quot;&gt;C:\OracleInstall&lt;/code&gt;, but you can call it whatever works for you. Here’s a screen shot of the directory after expanding both compressed files (done with WinZip 15).&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; margin: 0px 0px 0px 30px; padding: 0px;&quot;&gt;
You should notice that the two expanded compressed files put everything into a&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px;&quot;&gt;database&lt;/code&gt;&amp;nbsp;directory (or folder). Within the installation folder (&lt;code style=&quot;margin: 0px; padding: 0px;&quot;&gt;C:\OracleInstall\database&lt;/code&gt;), you double click on the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px;&quot;&gt;oui&lt;/code&gt;&amp;nbsp;icon to launch (start) the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Oracle Universal Installer&lt;/em&gt;. It’ll open a command prompt that may dwell on the screen for a few seconds up to maybe fifteen seconds.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install01.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5426&quot; height=&quot;300&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install01-265x300.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install01&quot; width=&quot;265&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;2&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;It’s a good idea to provide an email address for security updates no matter what. You can uncheck the box if you don’t want updates via Oracle Support Services. Click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Next&lt;/em&gt;&amp;nbsp;button to continue.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install02.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5430&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install02-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install02&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;3&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;Most developers want to&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Create and configure a database&lt;/em&gt;. If that’s your desire, leave the default radio button checked. Click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Next&lt;/em&gt;&amp;nbsp;button to continue.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install03.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5431&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install03-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install03&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;4&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;Most developers install their test instance on a desktop or laptop. If that’s your desire, leave the default&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Desktop Class&lt;/em&gt;&amp;nbsp;radio button checked. Click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Next&lt;/em&gt;&amp;nbsp;button to continue.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install04.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5432&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install04-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install04&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;5&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;These are default settings and generally the easiest to use. I’d suggest you change the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Character Set&lt;/em&gt;&amp;nbsp;drop down to Unicode. Then, enter a password twice. Oracle requires that you use at least one capital letter and one number in a 6 character or more long password. Click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Next&lt;/em&gt;&amp;nbsp;button to continue.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install05.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5433&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install05-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install05&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;6&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The next screen is a progress bar that checks for prerequisites. You shouldn’t have to do anything here because it automatically advances you to the next dialog screen. This generally takes less than a minute to run but can take two or so. If you’re much beyond 3 minutes there may be a resource problem with your Windows PC or virtual machine.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install06.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5434&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install06-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install06&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;7&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;This shows you all the selected values for the installation. Unless you want to abort the installation, click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Finish&lt;/em&gt;&amp;nbsp;button to proceed.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install07.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5436&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install07-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install07&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;8&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;This screen is the main progress bar, and you’ll be here somewhere between 5 and 10 minutes. The downside is that there are some dialogs that will popup during this phase and you need to authorize them, so it’s a bad time to take a break.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install08.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5437&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install08-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install08&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;9&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The first popup screen requires you to authorize the Java runtime to call home. You should click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Allow Access&lt;/em&gt;&amp;nbsp;button to proceed.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install09.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5438&quot; height=&quot;214&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install09-300x214.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install09&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;10&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;When the progress bar starts configuring the instance, failures can occur. The first may occur during the network configuration, which typically happens if you didn’t preconfigure the&amp;nbsp;&lt;code style=&quot;margin: 0px; padding: 0px;&quot;&gt;hosts&lt;/code&gt;&amp;nbsp;file. You don’t need to do anything but watch here unless the installer triggers an error.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install10.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5439&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install10-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install10&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;11&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The following progress bar is launched by the Oracle Database Configuration Assistant. It typically runs without a problem. You don’t need to do anything but watch here unless the installer triggers an error. This takes a few minutes, and unfortunately requires you to stick aroung to again authorize Java.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install11.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5440&quot; height=&quot;209&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install11-300x209.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install11&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;12&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The second popup screen requires you to authorize the Java runtime to call home. You should click the&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Allow Access&lt;/em&gt;&amp;nbsp;button to proceed.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install12.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5441&quot; height=&quot;214&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install12-300x214.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install12&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;13&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The third and last popup screen asks you to whether you want to open other scheme. Generally, you should click the&amp;nbsp;&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;OK&lt;/em&gt;&amp;nbsp;button to proceed.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install13.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5442&quot; height=&quot;277&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install13-300x277.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install13&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;14&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;The next dialog shows you that the network and database instances are configured. It’s also running the OEM (Oracle Enterprise Manager) installation. You can wait here but it won’t be a long wait.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 15px; padding: 0px;&quot;&gt;
&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install14.png&quot; style=&quot;color: #004477; margin: 0px; padding: 0px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-5444&quot; height=&quot;225&quot; src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2011/12/Oracle11gR2_Install14-300x225.png&quot; style=&quot;border: none; display: block; margin: 0px auto; padding: 2px;&quot; title=&quot;Oracle11gR2_Install14&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ol start=&quot;15&quot; style=&quot;background-color: white; color: #222222; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 18px; margin: 0px 0px 15px 30px; padding: 0px;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 5px; padding: 0px;&quot;&gt;This is the last dialog and says you’ve installed Oracle Database 11g Release 2 successfully. You can the&lt;em style=&quot;margin: 0px; padding: 0px;&quot;&gt;Close&lt;/em&gt;&amp;nbsp;button to complete the installation.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/3776667041165567305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/3776667041165567305?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3776667041165567305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3776667041165567305'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/10/oracle-11g-release-2-installation-steps.html' title='Oracle 11g Release 2 Installation Steps'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-5010127193712173464</id><published>2012-09-05T19:56:00.001+05:30</published><updated>2012-09-05T19:56:46.150+05:30</updated><title type='text'>Connecting Java and MySQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
As you all know Java is one of the best programming languages around and MySQL is the world’s most popular open source database. Often these are used to build business applications. There arises the need to connect both of these technologies. But for a newbie like me it is quite a daunting task to make them talk to each other. So, I am putting forward a tutorial showing how to accomplish the task.&lt;br /&gt;
&lt;br /&gt;
I am assuming that the reader have installed both Java and MySQL.&lt;br /&gt;
&lt;br /&gt;
First of all we need MySQL Connector/J driver. It is the official JDBC driver for MySQL. Which can be downloaded from &amp;nbsp;http://dev.mysql.com/downloads/connector/j/ .Moreover I have enclosed the driver used for this tutorial.&lt;br /&gt;
&lt;br /&gt;
It was the easy part. Now the most confusing part if you don’t know how to set classpath. Classpath can be set in more than one way. I shall use the method which I prefer the most.&lt;br /&gt;
&lt;br /&gt;
The file name of the MySQL Connector/J driver I have downloaded is&lt;br /&gt;
&lt;br /&gt;
mysql-connector-java-5.1.11-bin.jar&lt;br /&gt;
&lt;br /&gt;
I have kept this file in C:\Program Files\Java\jdk1.6.0_12\lib in my system. You can place it anywhere you like.&lt;br /&gt;
&lt;br /&gt;
JAR file (or Java ARchive) collection of many files into one. Java developers generally use .jar files to distribute Java applications or libraries, in the form of classes and associated metadata and resources. In this case mysql-connector-java-5.1.11-bin.jar file contains all the classes required for Java, MySQL connection.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now I shall set the classpath so that our program can use this library to connect the MySQL database.&lt;br /&gt;
&lt;br /&gt;
Click Start or the Windows icon in the bottom left corner of your screen. Then Select Computer, Properties.&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;jmcimg1.jpg&quot; src=&quot;http://www.geoindya.com/sites/default/files/jmcimg1.jpg&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Select Advanced System Settings&lt;br /&gt;
&lt;img alt=&quot;jmcimg2.jpg&quot; src=&quot;http://www.geoindya.com/sites/default/files/jmcimg2.jpg&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
Select Environment Variable in the System Properties Window&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;img alt=&quot;jmcimg3.jpg&quot; src=&quot;http://www.geoindya.com/sites/default/files/jmcimg3.jpg&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Choose ClassPath from the System Variable Pane and click Edit Button.&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;jmcimg4.jpg&quot; src=&quot;http://www.geoindya.com/sites/default/files/jmcimg4.jpg&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enter the Path of mysql-connector-java-5.1.11-bin.jar file after putting a semicolon in case there are previous settings. In most cases there you would find some. Click Ok couples of time. That’s all. &amp;nbsp;You have set the classpath. In some instances you might have to restart your system.&lt;br /&gt;
Now we shall write the code to connect MySQL database.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
import java.sql.*;&lt;br /&gt;
&lt;br /&gt;
public class TestConnection{&lt;br /&gt;
&amp;nbsp; public static void main(String[] args) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.out.println(&quot;MySQL Connect Example.&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Connection conn = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; String url = &quot;jdbc:mysql://localhost:3306/&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; String dbName = &quot;test&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; String driver = &quot;com.mysql.jdbc.Driver&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; String userName = &quot;root&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; String password = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; try {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; Class.forName(driver).newInstance();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; conn = DriverManager.getConnection(url+dbName,userName,password);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;Connected to the database&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; conn.close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; System.out.println(&quot;Disconnected from database&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; } catch (Exception e) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; e.printStackTrace();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;a href=&quot;&quot;&gt;mysql-connector-java-5.1.11-bin.jar is the best as i am connnected with it with the latest version am facing some issues will post after correcting them......&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;&quot;&gt;Thank you guys............Stay tuned !!!!!!!!&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/5010127193712173464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/5010127193712173464?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5010127193712173464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5010127193712173464'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/09/connecting-java-and-mysql.html' title='Connecting Java and MySQL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-5918369379139444966</id><published>2012-09-02T08:26:00.000+05:30</published><updated>2012-09-02T08:26:12.363+05:30</updated><title type='text'>Send HTTP request &amp; fetching data using Java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #222222; direction: ltr !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 14px; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; text-align: left; top: auto !important; vertical-align: baseline !important; width: 774px;&quot;&gt;&lt;tbody style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;tr style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&lt;td class=&quot;code&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 774px;&quot;&gt;&lt;div class=&quot;container&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;div class=&quot;line number1 index0 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;import&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;java.io.BufferedReader;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number2 index1 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;import&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;java.io.InputStreamReader;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number3 index2 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;import&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;java.net.URL;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number4 index3 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;line number5 index4 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;public&lt;/code&gt; &lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;class&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;Main {&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number6 index5 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;public&lt;/code&gt; &lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;static&lt;/code&gt; &lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;void&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;main(String[] args)&amp;nbsp; {&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number7 index6 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;try&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;{&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number8 index7 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&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;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;URL my_url = &lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;new&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;URL(&lt;/code&gt;&lt;code class=&quot;java string&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&quot;http://www.vikram-programmingwithjava.blogspot.in&quot;&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;);&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number9 index8 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&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;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;BufferedReader br = &lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;new&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;BufferedReader(&lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;new&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;InputStreamReader(my_url.openStream()));&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number10 index9 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&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;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;String strTemp = &lt;/code&gt;&lt;code class=&quot;java string&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&quot;&quot;&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;;&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number11 index10 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&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;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;while&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;(&lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;null&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;!= (strTemp = br.readLine())){&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number12 index11 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&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;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;System.out.println(strTemp);&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number13 index12 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number14 index13 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;} &lt;/code&gt;&lt;code class=&quot;java keyword&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;catch&lt;/code&gt; &lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;(Exception ex) {&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number15 index14 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&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;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;ex.printStackTrace();&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number16 index15 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number17 index16 alt2&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java spaces&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/code&gt;&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;div class=&quot;line number18 index17 alt1&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em 0px 0em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;&quot;&gt;
&lt;code class=&quot;java plain&quot; style=&quot;background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: black !important; direction: ltr !important; display: inline !important; float: none !important; font-family: Consolas, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/5918369379139444966/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/5918369379139444966?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5918369379139444966'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5918369379139444966'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/09/send-http-request-fetching-data-using.html' title='Send HTTP request &amp; fetching data using Java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-3501667983913560373</id><published>2012-09-02T08:01:00.003+05:30</published><updated>2012-09-02T08:10:28.113+05:30</updated><title type='text'>Connecting to Oracle using Java JDBC</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
import java.util.*;&lt;br /&gt;
import java.sql.*;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;public class OracleJdbcTest&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;String driverClass =
&quot;oracle.jdbc.driver.OracleDriver&quot;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Connection con;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;public void init(FileInputStream fs) throws
ClassNotFoundException, SQLException, FileNotFoundException, IOException&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Properties props = new Properties();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;props.load(fs);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;String url = props.getProperty(&quot;db.url&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;String userName = props.getProperty(&quot;db.user&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;String password = props.getProperty(&quot;db.password&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;Class.forName(driverClass);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;con=DriverManager.getConnection(url, userName, password);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;public void fetch() throws SQLException, IOException&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;PreparedStatement ps = con.prepareStatement(&quot;select
SYSDATE from dual&quot;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;ResultSet rs = ps.executeQuery();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;while (rs.next())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&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;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;// YOUR LOGIC&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;rs.close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;ps.close();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;public static void main(String[] args) &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;OracleJdbcTest test = new OracleJdbcTest();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;test.init();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;test.fetch();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt;&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;;&quot;&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-bidi-language: AR-SA; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-US;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/3501667983913560373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/3501667983913560373?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3501667983913560373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3501667983913560373'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/09/connecting-to-oracle-using-java-jdbc.html' title='Connecting to Oracle using Java JDBC'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-4588186142836037886</id><published>2012-08-26T16:24:00.000+05:30</published><updated>2012-08-26T16:24:19.141+05:30</updated><title type='text'>Java and My Sql datatypes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 24px;&quot;&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;The following table represent the default Java mapping for various common MySQL data types:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;2&quot; cellspacing=&quot;1&quot; style=&quot;background-color: white; color: black; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 24px; text-align: start; width: 33%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#C0C0C0&quot; width=&quot;50%&quot;&gt;&lt;div align=&quot;center&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: navy;&quot;&gt;MySQL Type&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;&lt;td bgcolor=&quot;#C0C0C0&quot; width=&quot;50%&quot;&gt;&lt;div align=&quot;center&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: navy;&quot;&gt;Java Type&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;CHAR&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;String&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;VARCHAR&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;String&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;LONGVARCHAR&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;String&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;NUMERIC&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;java.math.BigDecimal&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;DECIMAL&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;java.math.BigDecimal&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;BIT&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;boolean&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;TINYINT&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;byte&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;SMALLINT&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;short&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;INTEGER&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;int&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;BIGINT&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;long&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;REAL&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;float&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;FLOAT&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;double&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;DOUBLE&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;double&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;BINARY&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;byte []&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;VARBINARY&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;byte []&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;LONGVARBINARY&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;byte []&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;DATE&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;java.sql.Date&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;TIME&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;java.sql.Time&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;TIMESTAMP&lt;/span&gt;&lt;/td&gt;&lt;td width=&quot;50%&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;java.sql.Tiimestamp&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol style=&quot;background-color: white; font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 24px;&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;CHAR, VARCHAR and LONGVARCHAR&lt;/b&gt;&lt;br /&gt;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;data types&amp;nbsp;&lt;b&gt;CHAR&lt;/b&gt;,&amp;nbsp;&lt;b&gt;VARCHAR&lt;/b&gt;,&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;are closely related.&amp;nbsp;&lt;b&gt;CHAR&lt;/b&gt;&amp;nbsp;represents a small, fixed-length character string,&amp;nbsp;&lt;b&gt;VARCHAR&lt;/b&gt;&amp;nbsp;represents a small, variable-length character string, and&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;represents a large, variable-length character string. There is no need for Java programmer to distinguish these three&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;data types. These can be expressed identically in Java. These data types could be mapped in Java to either String or char[]. But String seemed more appropriate type for normal use. Java String class provide a method to convert a String into char[] and a constructor for converting a char[] into a String.&lt;br /&gt;&amp;nbsp;&lt;br /&gt;The method&amp;nbsp;&lt;b&gt;ResultSet.getString&lt;/b&gt;&amp;nbsp;allocates and returns a new String. It is suitable for retrieving data from&amp;nbsp;&lt;b&gt;CHAR&lt;/b&gt;,&amp;nbsp;&lt;b&gt;VARCHAR&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;fields. This is suitable for retrieving normal data, but&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;type can be used to store multi-megabyte strings. So that Java programmers needs a way to retrieve the&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;value in chunks. To handle this situation,&amp;nbsp;&lt;b&gt;ResultSet&lt;/b&gt;&amp;nbsp;interface have two methods for allowing programmers to retrieve a&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;value as a Java input stream from which they can subsequently read data in whatever size chunks they prefer. These methods are&amp;nbsp;&lt;b&gt;getAsciiStream&lt;/b&gt;&amp;nbsp;and&lt;b&gt;getCharacterStream&lt;/b&gt;, which deliver the data stored in a&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;column as a stream of&amp;nbsp;&lt;b&gt;ASCII&lt;/b&gt;&amp;nbsp;or&amp;nbsp;&lt;b&gt;Unicode&lt;/b&gt;&amp;nbsp;characters.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;NUMERIC and DECIMAL&lt;/b&gt;The&amp;nbsp;&lt;b&gt;NUMERIC&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;DECIMAL&lt;/b&gt;&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;data types are very similar. They both represent fixed point numbers where absolute precision is required. The most convenient Java mapping for these&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;data type is java.math.BigDecimal. This Java type provides math operations to allow&lt;b&gt;BigDecimal&lt;/b&gt;&amp;nbsp;types to be added, subtracted, multiplied, and divided with other&amp;nbsp;&lt;b&gt;BigDecimal&lt;/b&gt;types, with&amp;nbsp;&lt;b&gt;integer&lt;/b&gt;&amp;nbsp;types, and with&amp;nbsp;&lt;b&gt;floating&lt;/b&gt;&amp;nbsp;point types.&lt;br /&gt;&lt;br /&gt;We also allow access to these&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;types as simple&amp;nbsp;&lt;b&gt;Strings&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;char&lt;/b&gt;&amp;nbsp;[]. Thus, the Java programmers can use the&amp;nbsp;&lt;b&gt;getString()&lt;/b&gt;&amp;nbsp;to retrieve the&amp;nbsp;&lt;b&gt;NUMERICAL&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;DECIMAL&lt;/b&gt;&amp;nbsp;results.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;BINARY, VARBINARY and LONGVARBINARY&lt;/b&gt;&amp;nbsp;&lt;br /&gt;These&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;data types are closely related.&amp;nbsp;&lt;b&gt;BINARY&lt;/b&gt;&amp;nbsp;represents a small, fixed-length binary value,&amp;nbsp;&lt;b&gt;VARBINARY&lt;/b&gt;&amp;nbsp;represents a small, variable-length binary value and&amp;nbsp;&lt;b&gt;LONGVARBINARY&lt;/b&gt;represents a large, variable-length binary value. For Java programers there is no need to distinguish among these data types and they can all be expressed identically as byte arrays in Java. It is possible to read and write&amp;nbsp;&lt;b&gt;SQL&lt;/b&gt;&amp;nbsp;statements correctly without knowing the exact&lt;b&gt;BINARY&lt;/b&gt;&amp;nbsp;data type. The&amp;nbsp;&lt;b&gt;ResultSet.getBytes&lt;/b&gt;&amp;nbsp;method is used for retrieving the&amp;nbsp;&lt;b&gt;DECIMAL&lt;/b&gt;&amp;nbsp;and&lt;b&gt;NUMERICAL&lt;/b&gt;&amp;nbsp;values. Same as&amp;nbsp;&lt;b&gt;LONGVARCHAR&lt;/b&gt;&amp;nbsp;type,&amp;nbsp;&lt;b&gt;LONGVARBINARY&lt;/b&gt;&amp;nbsp;type can also be used to return multi-megabyte data values then the method&amp;nbsp;&lt;b&gt;getBinaryStream&lt;/b&gt;&amp;nbsp;is recommended.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;BIT&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: navy;&quot;&gt;The&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;type&amp;nbsp;&lt;b&gt;BIT&lt;/b&gt;&amp;nbsp;represents a single bit value that can be &#39;&lt;b&gt;zero&lt;/b&gt;&#39; or &#39;&lt;b&gt;one&lt;/b&gt;&#39;. And this&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;type can be mapped directly to the Java boolean type.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;TINYINT, SMALLINT, INTEGER and BIGINT&lt;/b&gt;&lt;br /&gt;The&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;&lt;b&gt;TINYINT&lt;/b&gt;&amp;nbsp;type represents an 8-bit integer value between 0 and 255 that may be signed or unsigned.&amp;nbsp;&lt;b&gt;SMALLINT&lt;/b&gt;&amp;nbsp;type represents a 16-bit signed integer value between -32768 and 32767.&amp;nbsp;&lt;b&gt;INTEGER&lt;/b&gt;&amp;nbsp;type represents a 32-bit signed integer value between -2147483648 and 2147483647.&amp;nbsp;&lt;b&gt;BIGINT&lt;/b&gt;&amp;nbsp;type represents an 64-bit signed integer value between -9223372036854775808 and 9223372036854775807. These MySQL TINYINT, SMALLINT, INTEGER, and BIGINT types can be mapped to Java&#39;s byte, short, int and long data types respectively.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;REAL, FLOAT and DOUBLE&lt;/b&gt;&lt;br /&gt;The&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;&lt;b&gt;REAL&lt;/b&gt;&amp;nbsp;represents a &quot;&lt;b&gt;single precision&lt;/b&gt;&quot; floating point number that supports seven digits of mantissa and the&amp;nbsp;&lt;b&gt;FLOAT&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;DOUBLE&lt;/b&gt;&amp;nbsp;type represents a &quot;&lt;b&gt;double precision&lt;/b&gt;&quot; floating point number that supports 15 digits of mantissa. The recommended Java mapping for&amp;nbsp;&lt;b&gt;REAL&lt;/b&gt;type to Java float and&amp;nbsp;&lt;b&gt;FLOAT&lt;/b&gt;,&amp;nbsp;&lt;b&gt;DOUBLE&lt;/b&gt;&amp;nbsp;type to Java double.&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;DATE, TIME and TIMESTAMP&lt;/b&gt;&lt;br /&gt;These three&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;types are related to time. The&amp;nbsp;&lt;b&gt;DATE&lt;/b&gt;&amp;nbsp;type represents a date consisting of day, month, and year, the&amp;nbsp;&lt;b&gt;TIME&lt;/b&gt;&amp;nbsp;type represents a time consisting of hours, minutes, and seconds and the&amp;nbsp;&lt;b&gt;TIMESTAMP&lt;/b&gt;&amp;nbsp;type represents&amp;nbsp;&lt;b&gt;DATE&lt;/b&gt;&amp;nbsp;plus&amp;nbsp;&lt;b&gt;TIME&lt;/b&gt;&amp;nbsp;plus a nanosecond field. The standard Java class&amp;nbsp;&lt;b&gt;&lt;i&gt;java.util.Date&lt;/i&gt;&lt;/b&gt;&amp;nbsp;that provides date and time information but does not match any of these three&amp;nbsp;&lt;b&gt;MySQL&lt;/b&gt;&amp;nbsp;&lt;b&gt;date/time&lt;/b&gt;&amp;nbsp;types exactly, because it has&amp;nbsp;&lt;b&gt;DATE&lt;/b&gt;&amp;nbsp;and&amp;nbsp;&lt;b&gt;TIME&lt;/b&gt;&amp;nbsp;information but no nanoseconds.&lt;br /&gt;That&#39;s why we define three subclasses of&amp;nbsp;&lt;b&gt;&lt;i&gt;java.util.Date&lt;/i&gt;&lt;/b&gt;. These are:&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;ul type=&quot;disc&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;&lt;b&gt;&lt;i&gt;java.sql.Date&lt;/i&gt;&lt;/b&gt;&amp;nbsp;for SQL DATE information.&lt;/span&gt;&lt;/li&gt;
&lt;span style=&quot;color: navy;&quot;&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;b&gt;&lt;i&gt;java.sql.Time&lt;/i&gt;&lt;/b&gt;&amp;nbsp;for SQL TIME information.&lt;/span&gt;&lt;/li&gt;
&lt;/span&gt;
&lt;li&gt;&lt;span style=&quot;color: navy;&quot;&gt;&lt;i&gt;&lt;b&gt;java.sql.Timestamp&lt;/b&gt;&lt;/i&gt;&amp;nbsp;for SQL TIMESTAMP information.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/4588186142836037886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/4588186142836037886?isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4588186142836037886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4588186142836037886'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/java-and-my-sql-datatypes.html' title='Java and My Sql datatypes'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7196562259138560599.post-2692540645235991307</id><published>2012-08-26T16:12:00.002+05:30</published><updated>2012-08-26T16:12:18.100+05:30</updated><title type='text'>Java with MySql </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;section&quot; style=&quot;font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div class=&quot;titlepage&quot;&gt;
&lt;h2 class=&quot;title&quot; style=&quot;background-color: #333333; color: white; font-weight: normal; padding: 10px;&quot;&gt;
1.&amp;nbsp;Java Database Connectivity (JDBC)&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
The interface for accessing relational databases from Java is JDBC. Via JDBC you maintain the databases connection, issue database queries and updates and receive the results.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
JDBC is an interface independently of any database. For each database you require the database specific implementation of the JDBC driver.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; style=&quot;font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div class=&quot;titlepage&quot;&gt;
&lt;h2 class=&quot;title&quot; style=&quot;background-color: #333333; color: white; font-weight: normal; padding: 10px;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;overview&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot;&gt;&lt;/a&gt;2.&amp;nbsp;Introduction to MySQL&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
To learn to install and use MySQL please see&amp;nbsp;&lt;a class=&quot;ulink&quot; href=&quot;http://www.vogella.com/articles/MySQL/article.html&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot; target=&quot;_top&quot;&gt;MySQL - Tutorial&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
The following will assume that you have successfully installed MySQL and know how to access MySQL via the command line.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;section&quot; style=&quot;font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div class=&quot;titlepage&quot;&gt;
&lt;h2 class=&quot;title&quot; style=&quot;background-color: #333333; color: white; font-weight: normal; padding: 10px;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;jdbcdriver&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot;&gt;&lt;/a&gt;3.&amp;nbsp;MySQL JDBC driver&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
To connect to MySQL from Java you have to use the JDBC driver from MySQL. The MySQL JDBC driver is called &quot;MySQL Connector/J&quot;. You should be able to find the latest MySQL JDBC driver on this page&lt;a class=&quot;ulink&quot; href=&quot;http://dev.mysql.com/downloads/connector/j&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot; target=&quot;_top&quot;&gt;http://dev.mysql.com/downloads/connector/j&amp;nbsp;&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
The download contains a jar file which we require later.&lt;/div&gt;
&lt;/div&gt;
&lt;ins style=&quot;border: none; display: inline-table; font-family: Lato, arial, sans-serif; font-size: 16px; height: 90px; line-height: 24px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;ins id=&quot;aswift_1_anchor&quot; style=&quot;border: none; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;90&quot; hspace=&quot;0&quot; id=&quot;aswift_1&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_1&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;728&quot;&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;span style=&quot;background-color: white; font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;&lt;/span&gt;&lt;div class=&quot;section&quot; style=&quot;font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div class=&quot;titlepage&quot;&gt;
&lt;h2 class=&quot;title&quot; style=&quot;background-color: #333333; color: white; font-weight: normal; padding: 10px;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;database&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot;&gt;&lt;/a&gt;4.&amp;nbsp;Create example database&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
Start the MySQL command line client and paste the following SQL script into it to create a sample database which we can use as an example.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;programlisting&quot; style=&quot;background-color: #ffffee; border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; border-top-left-radius: 9px; border-top-right-radius: 9px; border: 1px solid rgb(187, 187, 187); font-family: &#39;Droid Sans Mono&#39;, Monaco, &#39;Bitstream Vera Sans Mono&#39;, &#39;Lucida Console&#39;, Terminal, monospace; font-size: 13px; line-height: 16px; margin: 10px; overflow: auto; padding: 1em; word-wrap: break-word;&quot;&gt;create database feedback;
use feedback;
CREATE USER sqluser IDENTIFIED BY &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;sqluserpw&#39;&lt;/span&gt;; 
grant usage on *.* to sqluser&lt;em&gt;&lt;span class=&quot;hl-annotation&quot; style=&quot;color: grey;&quot;&gt;@localhost&lt;/span&gt;&lt;/em&gt; identified by &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;sqluserpw&#39;&lt;/span&gt;; 
grant all privileges on feedback.* to sqluser&lt;em&gt;&lt;span class=&quot;hl-annotation&quot; style=&quot;color: grey;&quot;&gt;@localhost;&lt;/span&gt;&lt;/em&gt;

CREATE TABLE COMMENTS (id INT NOT NULL AUTO_INCREMENT, 
    MYUSER VARCHAR(&lt;span class=&quot;hl-number&quot;&gt;30&lt;/span&gt;) NOT NULL,
    EMAIL VARCHAR(&lt;span class=&quot;hl-number&quot;&gt;30&lt;/span&gt;), 
    WEBPAGE VARCHAR(&lt;span class=&quot;hl-number&quot;&gt;100&lt;/span&gt;) NOT NULL, 
    DATUM DATE NOT NULL, 
    SUMMERY VARCHAR(&lt;span class=&quot;hl-number&quot;&gt;40&lt;/span&gt;) NOT NULL,
    COMMENTS VARCHAR(&lt;span class=&quot;hl-number&quot;&gt;400&lt;/span&gt;) NOT NULL,
    PRIMARY KEY (ID));

INSERT INTO COMMENTS values (&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;default&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;lars&#39;&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;myemail@gmail.com&#39;&lt;/span&gt;,&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;http://www.vogella.com&#39;&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;2009-09-14 10:33:11&#39;&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;Summery&#39;&lt;/span&gt;,&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&#39;My first comment&#39;&lt;/span&gt;); &lt;/pre&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;lqm_ad&quot; lqm_format=&quot;728x90&quot; lqm_publisher=&quot;lqm.javaeclipseandroid.site&quot; lqm_tags=&quot;Java%20Mobile%20Android&quot; lqm_zone=&quot;ron&quot; style=&quot;font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;iframe frameborder=&quot;0&quot; height=&quot;90&quot; id=&quot;lqmad2&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; width=&quot;728&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;section&quot; style=&quot;font-family: Lato, arial, sans-serif; font-size: 16px; line-height: 24px;&quot;&gt;
&lt;div class=&quot;titlepage&quot;&gt;
&lt;h2 class=&quot;title&quot; style=&quot;background-color: #333333; color: white; font-weight: normal; padding: 10px;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;javaconnection&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot;&gt;&lt;/a&gt;5.&amp;nbsp;Java JDBC&lt;/h2&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
Create a Java project and a package &quot;de.vogella.mysql.first&quot;.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
Create a folder &quot;lib&quot; and copy the JDBC driver into this folder. Add the JDBC driver to your classpath. See&lt;a class=&quot;ulink&quot; href=&quot;http://www.vogella.com/articles/Eclipse/article.html#classpath&quot; style=&quot;color: #101010; font-family: Lato, arial, helvetica, sans-serif; font-weight: 700;&quot; target=&quot;_top&quot;&gt;Adding jars to the classpath&lt;/a&gt;&amp;nbsp;for details.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
Create the following class to connect to the MySQL database and perform queries, inserts and deletes. It also prints the metadata (table name, column names) of a query result.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;programlisting&quot; style=&quot;background-color: #ffffee; border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; border-top-left-radius: 9px; border-top-right-radius: 9px; border: 1px solid rgb(187, 187, 187); font-family: &#39;Droid Sans Mono&#39;, Monaco, &#39;Bitstream Vera Sans Mono&#39;, &#39;Lucida Console&#39;, Terminal, monospace; font-size: 13px; line-height: 16px; margin: 10px; overflow: auto; padding: 1em; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;package&lt;/span&gt; de.vogella.mysql.first;

&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.sql.Connection;
&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.sql.DriverManager;
&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.sql.PreparedStatement;
&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.sql.ResultSet;
&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.sql.SQLException;
&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.sql.Statement;
&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; java.util.Date;

&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;class&lt;/span&gt; MySQLAccess {
  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; Connection connect = null;
  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; Statement statement = null;
  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; PreparedStatement preparedStatement = null;
  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; ResultSet resultSet = null;

  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;void&lt;/span&gt; readDataBase() &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;throws&lt;/span&gt; Exception {
    &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;try&lt;/span&gt; {
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// This will load the MySQL driver, each DB has its own driver&lt;/em&gt;
      Class.forName(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;com.mysql.jdbc.Driver&quot;&lt;/span&gt;);
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// Setup the connection with the DB&lt;/em&gt;
      connect = DriverManager
          .getConnection(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;jdbc:mysql://localhost/feedback?&quot;&lt;/span&gt;
              + &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;user=sqluser&amp;amp;password=sqluserpw&quot;&lt;/span&gt;);

      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// Statements allow to issue SQL queries to the database&lt;/em&gt;
      statement = connect.createStatement();
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// Result set get the result of the SQL query&lt;/em&gt;
      resultSet = statement
          .executeQuery(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;select * from FEEDBACK.COMMENTS&quot;&lt;/span&gt;);
      writeResultSet(resultSet);

      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// PreparedStatements can use variables and are more efficient&lt;/em&gt;
      preparedStatement = connect
          .prepareStatement(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;insert into  FEEDBACK.COMMENTS values (default, ?, ?, ?, ? , ?, ?)&quot;&lt;/span&gt;);
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// &quot;myuser, webpage, datum, summery, COMMENTS from FEEDBACK.COMMENTS&quot;);&lt;/em&gt;
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// Parameters start with 1&lt;/em&gt;
      preparedStatement.setString(&lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Test&quot;&lt;/span&gt;);
      preparedStatement.setString(&lt;span class=&quot;hl-number&quot;&gt;2&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;TestEmail&quot;&lt;/span&gt;);
      preparedStatement.setString(&lt;span class=&quot;hl-number&quot;&gt;3&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;TestWebpage&quot;&lt;/span&gt;);
      preparedStatement.setDate(&lt;span class=&quot;hl-number&quot;&gt;4&lt;/span&gt;, &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;new&lt;/span&gt; java.sql.Date(&lt;span class=&quot;hl-number&quot;&gt;2009&lt;/span&gt;, &lt;span class=&quot;hl-number&quot;&gt;12&lt;/span&gt;, &lt;span class=&quot;hl-number&quot;&gt;11&lt;/span&gt;));
      preparedStatement.setString(&lt;span class=&quot;hl-number&quot;&gt;5&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;TestSummary&quot;&lt;/span&gt;);
      preparedStatement.setString(&lt;span class=&quot;hl-number&quot;&gt;6&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;TestComment&quot;&lt;/span&gt;);
      preparedStatement.executeUpdate();

      preparedStatement = connect
          .prepareStatement(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;SELECT myuser, webpage, datum, summery, COMMENTS from FEEDBACK.COMMENTS&quot;&lt;/span&gt;);
      resultSet = preparedStatement.executeQuery();
      writeResultSet(resultSet);

      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// Remove again the insert comment&lt;/em&gt;
      preparedStatement = connect
      .prepareStatement(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;delete from FEEDBACK.COMMENTS where myuser= ? ; &quot;&lt;/span&gt;);
      preparedStatement.setString(&lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;, &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Test&quot;&lt;/span&gt;);
      preparedStatement.executeUpdate();
      
      resultSet = statement
      .executeQuery(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;select * from FEEDBACK.COMMENTS&quot;&lt;/span&gt;);
      writeMetaData(resultSet);
      
    } &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;catch&lt;/span&gt; (Exception e) {
      &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;throw&lt;/span&gt; e;
    } &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;finally&lt;/span&gt; {
      close();
    }

  }

  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;void&lt;/span&gt; writeMetaData(ResultSet resultSet) &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;throws&lt;/span&gt; SQLException {
    &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;//   Now get some metadata from the database&lt;/em&gt;
    &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// Result set get the result of the SQL query&lt;/em&gt;
    
    System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;The columns in the table are: &quot;&lt;/span&gt;);
    
    System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Table: &quot;&lt;/span&gt; + resultSet.getMetaData().getTableName(&lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;));
    &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;for&lt;/span&gt;  (&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;int&lt;/span&gt; i = &lt;span class=&quot;hl-number&quot;&gt;1&lt;/span&gt;; i&amp;lt;= resultSet.getMetaData().getColumnCount(); i++){
      System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Column &quot;&lt;/span&gt; +i  + &lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot; &quot;&lt;/span&gt;+ resultSet.getMetaData().getColumnName(i));
    }
  }

  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;void&lt;/span&gt; writeResultSet(ResultSet resultSet) &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;throws&lt;/span&gt; SQLException {
    &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// ResultSet is initially before the first data set&lt;/em&gt;
    &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;while&lt;/span&gt; (resultSet.next()) {
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// It is possible to get the columns via name&lt;/em&gt;
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// also possible to get the columns via the column number&lt;/em&gt;
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// which starts at 1&lt;/em&gt;
      &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// e.g. resultSet.getSTring(2);&lt;/em&gt;
      String user = resultSet.getString(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;myuser&quot;&lt;/span&gt;);
      String website = resultSet.getString(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;webpage&quot;&lt;/span&gt;);
      String summery = resultSet.getString(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;summery&quot;&lt;/span&gt;);
      Date date = resultSet.getDate(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;datum&quot;&lt;/span&gt;);
      String comment = resultSet.getString(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;comments&quot;&lt;/span&gt;);
      System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;User: &quot;&lt;/span&gt; + user);
      System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Website: &quot;&lt;/span&gt; + website);
      System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Summery: &quot;&lt;/span&gt; + summery);
      System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Date: &quot;&lt;/span&gt; + date);
      System.out.println(&lt;span class=&quot;hl-string&quot; style=&quot;color: blue;&quot;&gt;&quot;Comment: &quot;&lt;/span&gt; + comment);
    }
  }

  &lt;em class=&quot;hl-comment&quot; style=&quot;color: #008800;&quot;&gt;// You need to close the resultSet&lt;/em&gt;
  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;void&lt;/span&gt; close() {
    &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;try&lt;/span&gt; {
      &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;if&lt;/span&gt; (resultSet != null) {
        resultSet.close();
      }

      &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;if&lt;/span&gt; (statement != null) {
        statement.close();
      }

      &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;if&lt;/span&gt; (connect != null) {
        connect.close();
      }
    } &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;catch&lt;/span&gt; (Exception e) {

    }
  }

} &lt;/pre&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
Create the following main program to test your class.&lt;/div&gt;
&lt;div style=&quot;margin-left: 10px; margin-right: 10px;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;programlisting&quot; style=&quot;background-color: #ffffee; border-bottom-left-radius: 9px; border-bottom-right-radius: 9px; border-top-left-radius: 9px; border-top-right-radius: 9px; border: 1px solid rgb(187, 187, 187); font-family: &#39;Droid Sans Mono&#39;, Monaco, &#39;Bitstream Vera Sans Mono&#39;, &#39;Lucida Console&#39;, Terminal, monospace; font-size: 13px; line-height: 16px; margin: 10px; overflow: auto; padding: 1em; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;package&lt;/span&gt; de.vogella.mysql.first.test;

&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;import&lt;/span&gt; de.vogella.mysql.first.MySQLAccess;

&lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;class&lt;/span&gt; Main {
  &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;void&lt;/span&gt; main(String[] args) &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;throws&lt;/span&gt; Exception {
    MySQLAccess dao = &lt;span class=&quot;hl-keyword&quot; style=&quot;color: #7f0055; font-weight: bold;&quot;&gt;new&lt;/span&gt; MySQLAccess();
    dao.readDataBase();
  }


} &lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/2692540645235991307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/2692540645235991307?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/2692540645235991307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/2692540645235991307'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/java-with-mysql.html' title='Java with MySql '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-8429836906551918102</id><published>2012-08-18T11:53:00.003+05:30</published><updated>2012-08-18T11:53:57.618+05:30</updated><title type='text'>JDBC – Insert A Record</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
Here’s an example to show you how to insert a record into table via JDBC statement. To issue a insert statement, calls the&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;Statement.executeUpdate()&lt;/code&gt;&amp;nbsp;method like this :&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #003399;&quot;&gt;Statement&lt;/span&gt; statement &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; dbConnection.&lt;span style=&quot;color: #006633;&quot;&gt;createStatement&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// execute the insert SQL stetement&lt;/span&gt;
statement.&lt;span style=&quot;color: #006633;&quot;&gt;executeUpdate&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;insertTableSQL&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
Full example…&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;com.mkyong.jdbc&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.DriverManager&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.Connection&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.SQLException&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.Statement&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.text.DateFormat&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.text.SimpleDateFormat&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; JDBCStatementInsertExample &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_DRIVER &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;oracle.jdbc.driver.OracleDriver&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_CONNECTION &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;jdbc:oracle:thin:@localhost:1521:MKYONG&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_USER &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;user&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_PASSWORD &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DateFormat&lt;/span&gt; dateFormat &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;SimpleDateFormat&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
   &lt;span style=&quot;color: blue;&quot;&gt;&quot;yyyy/MM/dd HH:mm:ss&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt; argv&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   insertRecordIntoDbUserTable&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; insertRecordIntoDbUserTable&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;Statement&lt;/span&gt; statement &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; insertTableSQL &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;INSERT INTO DBUSER&quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;(USER_ID, USERNAME, CREATED_BY, CREATED_DATE) &quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;VALUES&quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;(1,&#39;mkyong&#39;,&#39;system&#39;, &quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;to_date(&#39;&quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; getCurrentTimeStamp&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;&#39;, &#39;yyyy/mm/dd hh24:mi:ss&#39;))&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; getDBConnection&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   statement &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; dbConnection.&lt;span style=&quot;color: #006633;&quot;&gt;createStatement&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;insertTableSQL&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// execute insert SQL stetement&lt;/span&gt;
   statement.&lt;span style=&quot;color: #006633;&quot;&gt;executeUpdate&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;insertTableSQL&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Record is inserted into DBUSER table!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;finally&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;statement &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    statement.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    dbConnection.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; getDBConnection&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;Class&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;forName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;DB_DRIVER&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;ClassNotFoundException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DriverManager&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
                               DB_CONNECTION, DB_USER,DB_PASSWORD&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt; dbConnection&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt; dbConnection&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; getCurrentTimeStamp&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  java.&lt;span style=&quot;color: #006633;&quot;&gt;util&lt;/span&gt;.&lt;span style=&quot;color: #003399;&quot;&gt;Date&lt;/span&gt; today &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; java.&lt;span style=&quot;color: #006633;&quot;&gt;util&lt;/span&gt;.&lt;span style=&quot;color: #003399;&quot;&gt;Date&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt; dateFormat.&lt;span style=&quot;color: #006633;&quot;&gt;format&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;today.&lt;span style=&quot;color: #006633;&quot;&gt;getTime&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
Result&lt;/h4&gt;
&lt;div style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 20px;&quot;&gt;
A record is inserted into a table named “DBUSER”.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;sql&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INTO&lt;/span&gt; DBUSER&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;USER_ID&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; USERNAME&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; CREATED_BY&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; CREATED_DATE&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt; 
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;VALUES&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;mkyong&#39;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;system&#39;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; to_date&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;2011/04/04 13:59:03&#39;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&#39;yyyy/mm/dd hh24:mi:ss&#39;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt;
Record &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IS&lt;/span&gt; inserted &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INTO&lt;/span&gt; DBUSER &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt;!&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/8429836906551918102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/8429836906551918102?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/8429836906551918102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/8429836906551918102'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/jdbc-insert-record.html' title='JDBC – Insert A Record'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-5273957810115676423</id><published>2012-08-18T11:51:00.000+05:30</published><updated>2012-08-18T11:51:05.575+05:30</updated><title type='text'>JDBC - Create A Table</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1 class=&quot;post-title&quot; style=&quot;background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; letter-spacing: -1px; line-height: 1.15em; margin: 0px 0px 4px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
JDBC Statement Example – Create A Table&lt;/h1&gt;
&lt;div class=&quot;post-meta authorlink&quot; style=&quot;background-color: white; color: #ababab; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 12px; margin-bottom: 20px;&quot;&gt;
&lt;span style=&quot;color: #3c3c3c; font-size: 14px; line-height: 21px;&quot;&gt;Here’s an example to show you how to create a table in database via JDBC statement. To issue a create statement, calls the S&lt;/span&gt;&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; line-height: 21px; padding: 2px 4px;&quot;&gt;tatement.execute()&lt;/code&gt;&lt;span style=&quot;color: #3c3c3c; font-size: 14px; line-height: 21px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #3c3c3c; font-size: 14px; line-height: 21px;&quot;&gt;method like this :&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;post-content&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #003399;&quot;&gt;Statement&lt;/span&gt; statement &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; dbConnection.&lt;span style=&quot;color: #006633;&quot;&gt;createStatement&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// execute create SQL stetement&lt;/span&gt;
statement.&lt;span style=&quot;color: #006633;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;createTableSQL&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Full example…&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;com.mkyong.jdbc&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.DriverManager&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.Connection&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.SQLException&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.Statement&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; JDBCStatementCreateExample &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_DRIVER &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;oracle.jdbc.driver.OracleDriver&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_CONNECTION &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;jdbc:oracle:thin:@localhost:1521:MKYONG&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_USER &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;user&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; DB_PASSWORD &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt; argv&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   createDbUserTable&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; createDbUserTable&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;throws&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;Statement&lt;/span&gt; statement &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; createTableSQL &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;CREATE TABLE DBUSER(&quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;USER_ID NUMBER(5) NOT NULL, &quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;USERNAME VARCHAR(20) NOT NULL, &quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;CREATED_BY VARCHAR(20) NOT NULL, &quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;CREATED_DATE DATE NOT NULL, &quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;PRIMARY KEY (USER_ID) &quot;&lt;/span&gt;
    &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;)&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; getDBConnection&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   statement &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; dbConnection.&lt;span style=&quot;color: #006633;&quot;&gt;createStatement&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;createTableSQL&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
                        &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// execute the SQL stetement&lt;/span&gt;
   statement.&lt;span style=&quot;color: #006633;&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;createTableSQL&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Table &lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt;dbuser&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\&quot;&lt;/span&gt; is created!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;finally&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;statement &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    statement.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    dbConnection.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; getDBConnection&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;Class&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;forName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;DB_DRIVER&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;ClassNotFoundException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   dbConnection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DriverManager&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
     DB_CONNECTION, DB_USER,DB_PASSWORD&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt; dbConnection&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;e.&lt;span style=&quot;color: #006633;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt; dbConnection&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
Result&lt;/h4&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Here’s the result.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;sql&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; DBUSER&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;
  USER_ID &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NUMBER&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; 
  USERNAME &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; 
  CREATED_BY &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; 
  CREATED_DATE &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; 
  &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;KEY&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;(&lt;/span&gt;USER_ID&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt; 
&lt;span style=&quot;color: #66cc66;&quot;&gt;)&lt;/span&gt;
&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;&quot;user&quot;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IS&lt;/span&gt; created!&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/5273957810115676423/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/5273957810115676423?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5273957810115676423'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5273957810115676423'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/jdbc-create-table.html' title='JDBC - Create A Table'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-5055955444168442717</id><published>2012-08-16T23:56:00.004+05:30</published><updated>2012-08-16T23:56:53.974+05:30</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1 class=&quot;post-title&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 2em; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: -1px; line-height: 1.15em; margin: 0px 0px 4px; orphans: 2; text-align: start; text-indent: 0px; text-rendering: optimizelegibility; text-transform: capitalize; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Connect To Oracle DB Via JDBC Driver&lt;/h1&gt;
&lt;div class=&quot;post-content&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;ins style=&quot;border: none; display: inline-table; height: 33px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;/ins&gt;Here’s an example to show you how to connect to Oracle database via JDBC driver.&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
1. Download MySQL JDBC Driver&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Get Oracle JDBC driver here –&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html&quot; style=&quot;color: #0f3b68; text-decoration: underline;&quot; target=&quot;_blank&quot;&gt;ojdbcxxx.jar&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
2. Java JDBC Connection Example&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Code snippets to use JDBC to connect a Oracle database.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;Class&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;forName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;org.postgresql.Driver&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DriverManager&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
 &lt;span style=&quot;color: blue;&quot;&gt;&quot;jdbc:oracle:thin:@localhost:1521:mkyong&quot;&lt;/span&gt;,&lt;span style=&quot;color: blue;&quot;&gt;&quot;username&quot;&lt;/span&gt;,&lt;span style=&quot;color: blue;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
connection.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
See a complete example below :&lt;br /&gt;&lt;em style=&quot;font-style: italic;&quot;&gt;File : OracleJDBC.java&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.DriverManager&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.Connection&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.SQLException&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; OracleJDBC &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt; argv&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;-------- Oracle JDBC Connection Testing ------&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;Class&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;forName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;oracle.jdbc.driver.OracleDriver&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;ClassNotFoundException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Where is your Oracle JDBC Driver?&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   e.&lt;span style=&quot;color: #006633;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Oracle JDBC Driver Registered!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DriverManager&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
     &lt;span style=&quot;color: blue;&quot;&gt;&quot;jdbc:oracle:thin:@localhost:1521:mkyong&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;&quot;username&quot;&lt;/span&gt;,
     &lt;span style=&quot;color: blue;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Connection Failed! Check output console&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   e.&lt;span style=&quot;color: #006633;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;connection &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;You made it, take control your database now!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Failed to make connection!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
2. Run It&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Assume&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;OracleJDBC.java&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;is store in “&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;C:\jdbc-test&lt;/code&gt;” folder, together with Oracle JDBC driver (&lt;strong style=&quot;font-weight: bold;&quot;&gt;ojdbc6.jar&lt;/strong&gt;), then run following commands :&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;bash&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;C:\jdbc-test&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;javac OracleJDBC.java
&amp;nbsp;
C:\jdbc-test&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;java &lt;span style=&quot;color: #660033;&quot;&gt;-cp&lt;/span&gt; c:\jdbc-test\ojdbc6.jar;c:\jdbc-test OracleJDBC
&lt;span style=&quot;color: #660033;&quot;&gt;--------&lt;/span&gt; Oracle JDBC Connection Testing &lt;span style=&quot;color: #660033;&quot;&gt;------------&lt;/span&gt;
Oracle JDBC Driver Registered&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;!&lt;/span&gt;
You made it, take control your database now&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;!&lt;/span&gt;
&amp;nbsp;
C:\jdbc-test&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Done&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/5055955444168442717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/5055955444168442717?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5055955444168442717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/5055955444168442717'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/connect-to-oracle-db-via-jdbc-driver.html' title=''/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-3249192537196736588</id><published>2012-08-16T23:55:00.004+05:30</published><updated>2012-08-16T23:55:54.935+05:30</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1 class=&quot;post-title&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 2em; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: -1px; line-height: 1.15em; margin: 0px 0px 4px; orphans: 2; text-align: start; text-indent: 0px; text-rendering: optimizelegibility; text-transform: capitalize; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Connect To MySQL With JDBC Driver&lt;/h1&gt;
&lt;div class=&quot;post-content&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;ins style=&quot;border: none; display: inline-table; height: 33px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;/ins&gt;Here’s an example to show you how to connect to MySQL database via JDBC driver.&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
1. Download MySQL JDBC Driver&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Get a MySQL JDBC driver from here -&lt;a href=&quot;http://dev.mysql.com/downloads/connector/j/5.1.html&quot; style=&quot;color: #0f3b68; text-decoration: underline;&quot; target=&quot;_blank&quot;&gt;MySQL JDBC Driver Download Here&lt;/a&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
2. Java JDBC Connection Example&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Code snippets to use JDBC to connect a MySQL database.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;Class&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;forName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;com.mysql.jdbc.Driver&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DriverManager&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
          &lt;span style=&quot;color: blue;&quot;&gt;&quot;jdbc:mysql://hostname:port/dbname&quot;&lt;/span&gt;,&lt;span style=&quot;color: blue;&quot;&gt;&quot;username&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  connection.&lt;span style=&quot;color: #006633;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
See a complete example below :&lt;br /&gt;&lt;em style=&quot;font-style: italic;&quot;&gt;File : JDBCExample.java&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;com.mkyong.common&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.DriverManager&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.Connection&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;java.sql.SQLException&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; JDBCExample &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; main&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;]&lt;/span&gt; argv&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;-------- MySQL JDBC Connection Testing ------------&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;Class&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;forName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;com.mysql.jdbc.Driver&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;ClassNotFoundException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Where is your MySQL JDBC Driver?&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   e.&lt;span style=&quot;color: #006633;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;MySQL JDBC Driver Registered!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;Connection&lt;/span&gt; connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   connection &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;DriverManager&lt;/span&gt;
     .&lt;span style=&quot;color: #006633;&quot;&gt;getConnection&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;jdbc:mysql://localhost:3306/mkyongcom&quot;&lt;/span&gt;,
       &lt;span style=&quot;color: blue;&quot;&gt;&quot;root&quot;&lt;/span&gt;, &lt;span style=&quot;color: blue;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;SQLException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Connection Failed! Check output console&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   e.&lt;span style=&quot;color: #006633;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;connection &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;You made it, take control your database now!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;else&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
   &lt;span style=&quot;color: #003399;&quot;&gt;System&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;out&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;Failed to make connection!&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
3. Run It&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Assume&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;JDBCExample.java&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;is store in&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;c:\test&lt;/code&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;folder, together with MySQL JDBC driver&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;bash&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;C:\&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;java &lt;span style=&quot;color: #660033;&quot;&gt;-cp&lt;/span&gt; c:\&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;test&lt;/span&gt;\mysql-connector-java-5.1.8-bin.jar;c:\&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;test&lt;/span&gt; JDBCExample
&lt;span style=&quot;color: #660033;&quot;&gt;--------&lt;/span&gt; MySQL JDBC Connection Testing &lt;span style=&quot;color: #660033;&quot;&gt;------------&lt;/span&gt;
MySQL JDBC Driver Registered&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;!&lt;/span&gt;
You made it, take control your database now&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;!&lt;/span&gt;
&amp;nbsp;
C:\&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;test&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/3249192537196736588/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/3249192537196736588?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3249192537196736588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3249192537196736588'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/connect-to-mysql-with-jdbc-driver-heres.html' title=''/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-3275442296923036478</id><published>2012-08-16T23:54:00.002+05:30</published><updated>2012-08-16T23:54:19.073+05:30</updated><title type='text'>Android Button Example</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h1 class=&quot;post-title&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 2em; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: -1px; line-height: 1.15em; margin: 0px 0px 4px; orphans: 2; text-align: start; text-indent: 0px; text-rendering: optimizelegibility; text-transform: capitalize; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
Android Button Example&lt;/h1&gt;
&lt;h1 class=&quot;post-title&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 2em; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: -1px; line-height: 1.15em; margin: 0px 0px 4px; orphans: 2; text-align: start; text-indent: 0px; text-rendering: optimizelegibility; text-transform: capitalize; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&amp;nbsp;&lt;/h1&gt;
&lt;div class=&quot;post-content&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;&quot;&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
In Android, just use “&lt;a href=&quot;http://developer.android.com/reference/android/widget/Button.html&quot; style=&quot;color: #0f3b68; text-decoration: underline;&quot; target=&quot;_blank&quot;&gt;android.widget.Button&lt;/a&gt;” class to display a normal button.&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
In this tutorial, we show you how to display a normal button, add a click listener, when user click on the button, open an URL in your Android’s internet browser.&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
&lt;em style=&quot;font-style: italic;&quot;&gt;P.S This project is developed in Eclipse 3.7, and tested with Android 2.3.3.&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;note&quot; style=&quot;background-color: #e6e6fc; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(209, 209, 232); margin: 20px 0px; padding: 20px;&quot;&gt;
&lt;strong style=&quot;font-weight: bold;&quot;&gt;Note&lt;/strong&gt;&lt;br /&gt;For more advance function, like image, please refer to this&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.mkyong.com/android/android-imagebutton-example/&quot; style=&quot;color: #0f3b68; text-decoration: underline;&quot; target=&quot;_blank&quot;&gt;ImageButton example&lt;/a&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;and also this&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://www.mkyong.com/android/android-imagebutton-selector-example/&quot; style=&quot;color: #0f3b68; text-decoration: underline;&quot; target=&quot;_blank&quot;&gt;ImageButton selector example&lt;/a&gt;.&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
1. Add Button&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Open “&lt;strong style=&quot;font-weight: bold;&quot;&gt;res/layout/main.xml&lt;/strong&gt;” file, add a button.&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
&lt;em style=&quot;font-style: italic;&quot;&gt;File : res/layout/main.xml&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;xml&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;encoding&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;LinearLayout&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;xmlns:android&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_width&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_height&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:orientation&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;vertical&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;Button&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:id&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@+id/button1&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_width&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_height&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:text&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;Button - Go to mkyong.com&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/LinearLayout&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
2. Code Code&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Attach a click listener to the button.&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
When user click on it, open mobile browser and display URL :&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;em style=&quot;font-style: italic;&quot;&gt;http://www.mkyong.com&lt;/em&gt;.&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
&lt;em style=&quot;font-style: italic;&quot;&gt;File : MyAndroidAppActivity.java&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; display: block; font-family: monospace; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;com.mkyong.android&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.app.Activity&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.content.Intent&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.net.Uri&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.os.Bundle&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.widget.Button&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.view.View&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.view.View.OnClickListener&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; MyAndroidAppActivity &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;extends&lt;/span&gt; Activity &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #003399;&quot;&gt;Button&lt;/span&gt; button&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 @Override
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onCreate&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Bundle savedInstanceState&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;super&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;onCreate&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;savedInstanceState&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  setContentView&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;layout&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  addListenerOnButton&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; addListenerOnButton&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  button &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; findViewById&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;id&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;button1&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  button.&lt;span style=&quot;color: #006633;&quot;&gt;setOnClickListener&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; OnClickListener&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   @Override
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onClick&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;View&lt;/span&gt; arg0&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
     Intent browserIntent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; 
                            &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; Intent&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Intent.&lt;span style=&quot;color: #006633;&quot;&gt;ACTION_VIEW&lt;/span&gt;, Uri.&lt;span style=&quot;color: #006633;&quot;&gt;parse&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;http://www.mkyong.com&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
       startActivity&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;browserIntent&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
3. Demo&lt;/h4&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
Run the application.&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
1. Result, a normal button.&lt;/div&gt;
&lt;div class=&quot;pic&quot; style=&quot;background-color: #f9f9f9; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); margin: 20px 0px; padding: 20px; text-align: center;&quot;&gt;
&lt;img alt=&quot;android button demo1&quot; height=&quot;480&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2011/12/android-button-demo1.png&quot; style=&quot;border: 0px; max-width: 100%; vertical-align: middle;&quot; title=&quot;android-button-demo1&quot; width=&quot;318&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;margin: 0px 0px 20px;&quot;&gt;
2. Click on the button, display URL in browser.&lt;/div&gt;
&lt;div class=&quot;pic&quot; style=&quot;background-color: #f9f9f9; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); margin: 20px 0px; padding: 20px; text-align: center;&quot;&gt;
&lt;img alt=&quot;android button demo2&quot; height=&quot;480&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2011/12/android-button-demo2.png&quot; style=&quot;border: 0px; max-width: 100%; vertical-align: middle;&quot; title=&quot;android-button-demo2&quot; width=&quot;318&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/3275442296923036478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/3275442296923036478?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3275442296923036478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/3275442296923036478'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/android-button-example.html' title='Android Button Example'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-4024639526854873776</id><published>2012-08-12T10:54:00.002+05:30</published><updated>2012-08-12T10:54:36.257+05:30</updated><title type='text'>How To Make A Phone Call In Android</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h1 class=&quot;post-title&quot; style=&quot;background-color: white; color: #252525; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; letter-spacing: -1px; line-height: 1.15em; margin: 0px 0px 4px; position: relative; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
How To Make A Phone Call In Android&lt;/h1&gt;
&lt;div class=&quot;post-content&quot; style=&quot;background-color: white; color: #3c3c3c; font-family: &#39;Droid Sans&#39;, Helvetica, Arial, sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;
&lt;ins style=&quot;border: none; display: inline-table; height: 33px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;ins id=&quot;aswift_0_anchor&quot; style=&quot;border: none; display: block; height: 33px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;33&quot; hspace=&quot;0&quot; id=&quot;aswift_0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_0&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;728&quot;&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;div id=&quot;dd_light_ajax_float&quot; style=&quot;background-attachment: scroll; background-image: none; background-position: 0px 0px; background-repeat: repeat repeat; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); float: left; margin-left: -95px; margin-right: 10px; margin-top: 10px; position: fixed; top: 18px; z-index: 9999;&quot;&gt;
&lt;div id=&quot;dd_content_wrap&quot;&gt;
&lt;div class=&quot;dd_light_button&quot; style=&quot;padding: 8px 8px 0px;&quot;&gt;
&lt;div id=&quot;___plusone_0&quot; style=&quot;background-color: transparent; border-style: none; display: inline-block; float: none; font-size: 1px; height: 60px; line-height: normal; margin: 0px; padding: 0px; vertical-align: baseline; width: 50px;&quot;&gt;
&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; hspace=&quot;0&quot; id=&quot;I0_1344745119114&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;I0_1344745119114&quot; scrolling=&quot;no&quot; src=&quot;https://plusone.google.com/_/+1/fastbutton?bsv=pr&amp;amp;url=http%3A%2F%2Fwww.mkyong.com%2Fandroid%2Fhow-to-make-a-phone-call-in-android%2F&amp;amp;size=tall&amp;amp;count=true&amp;amp;origin=http%3A%2F%2Fwww.mkyong.com&amp;amp;hl=en-US&amp;amp;jsh=m%3B%2F_%2Fapps-static%2F_%2Fjs%2Fgapi%2F__features__%2Frt%3Dj%2Fver%3D8SlULC_tJHc.en_GB.%2Fsv%3D1%2Fam%3D!9WWg3hgFJrKAVXxNQA%2Fd%3D1%2Frs%3DAItRSTOOHXkG8WMvfGFsZm299vmf_ruLCw#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Conload&amp;amp;id=I0_1344745119114&amp;amp;parent=http%3A%2F%2Fwww.mkyong.com&quot; style=&quot;border-style: none; height: 60px; left: 0px; margin: 0px; position: static; top: 0px; visibility: visible; width: 50px;&quot; tabindex=&quot;0&quot; title=&quot;+1&quot; vspace=&quot;0&quot; width=&quot;100%&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;dd_light_button&quot; style=&quot;padding: 8px 8px 0px;&quot;&gt;
&lt;iframe frameborder=&quot;0&quot; height=&quot;62&quot; id=&quot;dd-fblike-iframe&quot; scrolling=&quot;no&quot; src=&quot;http://www.facebook.com/plugins/like.php?href=http://www.mkyong.com/android/how-to-make-a-phone-call-in-android/&amp;amp;send=false&amp;amp;layout=box_count&amp;amp;show_faces=false&amp;amp;action=like&amp;amp;colorscheme=light&amp;amp;font=verdana&amp;amp;height=62&amp;amp;width=50&quot; width=&quot;50&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;dd_light_button&quot; style=&quot;padding: 8px 8px 0px;&quot;&gt;
&lt;iframe allowtransparency=&quot;true&quot; class=&quot;twitter-share-button twitter-count-vertical&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;http://platform.twitter.com/widgets/tweet_button.1340179658.html#_=1344745120358&amp;amp;count=vertical&amp;amp;id=twitter-widget-0&amp;amp;lang=en&amp;amp;original_referer=http%3A%2F%2Fwww.mkyong.com%2Fandroid%2Fhow-to-make-a-phone-call-in-android%2F&amp;amp;size=m&amp;amp;text=How%20to%20make%20a%20phone%20call%20in%20Android&amp;amp;url=http%3A%2F%2Fwww.mkyong.com%2Fandroid%2Fhow-to-make-a-phone-call-in-android%2F&amp;amp;via=mkyong&quot; style=&quot;height: 62px; width: 59px;&quot; title=&quot;Twitter Tweet Button&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
In this tutorial, we show you how to make a phone call in Android,and monitor the phone call states via&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;PhoneStateListener&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
&lt;em&gt;P.S This project is developed in Eclipse 3.7, and tested with Android 2.3.3.&lt;/em&gt;&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; position: relative; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
1 Android Layout Files&lt;/h4&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Simpel layout file, to display a button.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
&lt;em&gt;File : res/layout/main.xml&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;xml&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;encoding&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;LinearLayout&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;xmlns:android&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_width&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_height&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;fill_parent&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:orientation&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;vertical&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;Button&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:id&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@+id/buttonCall&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_width&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:layout_height&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;wrap_content&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:text&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;call 0377778888&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/LinearLayout&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;margin: 20px 0px;&quot;&gt;
&lt;ins style=&quot;border: none; display: inline-table; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;ins id=&quot;aswift_1_anchor&quot; style=&quot;border: none; display: block; height: 90px; margin: 0px; padding: 0px; position: relative; visibility: visible; width: 728px;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;90&quot; hspace=&quot;0&quot; id=&quot;aswift_1&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_1&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;728&quot;&gt;&lt;/iframe&gt;&lt;span style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; line-height: 1.2em; text-transform: capitalize;&quot;&gt;2. Activity&lt;/span&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Use below code snippet to make a phone call in Android.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt; Intent callIntent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; Intent&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Intent.&lt;span style=&quot;color: #006633;&quot;&gt;ACTION_CALL&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 callIntent.&lt;span style=&quot;color: #006633;&quot;&gt;setData&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Uri.&lt;span style=&quot;color: #006633;&quot;&gt;parse&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;tel:0377778888&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 startActivity&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;callIntent&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
&lt;em&gt;File : MainActivity.java&lt;/em&gt;&amp;nbsp;– When the button is call, make a phone to 0377778888.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;com.mkyong.android&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.app.Activity&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.content.Intent&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.net.Uri&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.os.Bundle&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.view.View&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.view.View.OnClickListener&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.widget.Button&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; MainActivity &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;extends&lt;/span&gt; Activity &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;Button&lt;/span&gt; button&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onCreate&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Bundle savedInstanceState&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;super&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;onCreate&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;savedInstanceState&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  setContentView&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;layout&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  button &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; findViewById&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;id&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;buttonCall&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// add button listener&lt;/span&gt;
  button.&lt;span style=&quot;color: #006633;&quot;&gt;setOnClickListener&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; OnClickListener&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   @Override
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onClick&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;View&lt;/span&gt; arg0&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
    Intent callIntent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; Intent&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Intent.&lt;span style=&quot;color: #006633;&quot;&gt;ACTION_CALL&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
    callIntent.&lt;span style=&quot;color: #006633;&quot;&gt;setData&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Uri.&lt;span style=&quot;color: #006633;&quot;&gt;parse&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;tel:0377778888&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
    startActivity&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;callIntent&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; position: relative; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
3 Android Manifest&lt;/h4&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
To make a phone call, Android need&amp;nbsp;&lt;strong&gt;CALL_PHONE&lt;/strong&gt;&amp;nbsp;permission.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;xml&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.permission.CALL_PHONE&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
&lt;em&gt;File : AndroidManifest.xml&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;xml&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;encoding&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;manifest&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;xmlns:android&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;package&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;com.mkyong.android&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:versionCode&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:versionName&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-sdk&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:minSdkVersion&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;10&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.permission.CALL_PHONE&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;application&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:icon&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@drawable/ic_launcher&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:label&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@string/app_name&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
        &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;activity&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;            &lt;span style=&quot;color: #000066;&quot;&gt;android:label&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@string/app_name&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;            &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;.MainActivity&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;intent-filter&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;action&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.intent.action.MAIN&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;category&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.intent.category.LAUNCHER&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/intent-filter&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/activity&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/application&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/manifest&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; position: relative; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
4. PhoneStateListener Example&lt;/h4&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Ok, now we update the above activity, to monitor the phone call states, when a phone call is ended, come back to the original activity (actually, it just restart the activity). Read comment, it should be self-explanatory.&lt;/div&gt;
&lt;div class=&quot;note&quot; style=&quot;background-color: #e6e6fc; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(209, 209, 232); margin: 20px 0px; padding: 20px;&quot;&gt;
&lt;strong&gt;Note&lt;/strong&gt;&lt;br /&gt;Run it and refer to the logcat console to understand how&amp;nbsp;&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;PhoneStateListener&lt;/code&gt;&amp;nbsp;works.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
&lt;em&gt;File : MainActivity.java&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;java&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;package&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;com.mkyong.android&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.app.Activity&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.content.Context&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.content.Intent&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.net.Uri&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.os.Bundle&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.telephony.PhoneStateListener&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.telephony.TelephonyManager&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.util.Log&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.view.View&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.view.View.OnClickListener&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #006699;&quot;&gt;android.widget.Button&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; MainActivity &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;extends&lt;/span&gt; Activity &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;final&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;Context&lt;/span&gt; context &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #003399;&quot;&gt;Button&lt;/span&gt; button&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onCreate&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Bundle savedInstanceState&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;super&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;onCreate&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;savedInstanceState&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  setContentView&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;layout&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  button &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;Button&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; findViewById&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;R.&lt;span style=&quot;color: #006633;&quot;&gt;id&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;buttonCall&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// add PhoneStateListener&lt;/span&gt;
  PhoneCallListener phoneListener &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; PhoneCallListener&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  TelephonyManager telephonyManager &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;TelephonyManager&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;this&lt;/span&gt;
   .&lt;span style=&quot;color: #006633;&quot;&gt;getSystemService&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;Context&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;TELEPHONY_SERVICE&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  telephonyManager.&lt;span style=&quot;color: #006633;&quot;&gt;listen&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;phoneListener,PhoneStateListener.&lt;span style=&quot;color: #006633;&quot;&gt;LISTEN_CALL_STATE&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// add button listener&lt;/span&gt;
  button.&lt;span style=&quot;color: #006633;&quot;&gt;setOnClickListener&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; OnClickListener&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   @Override
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onClick&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;View&lt;/span&gt; arg0&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
    Intent callIntent &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;new&lt;/span&gt; Intent&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Intent.&lt;span style=&quot;color: #006633;&quot;&gt;ACTION_CALL&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
    callIntent.&lt;span style=&quot;color: #006633;&quot;&gt;setData&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Uri.&lt;span style=&quot;color: #006633;&quot;&gt;parse&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&quot;tel:0377778888&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
    startActivity&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;callIntent&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;//monitor phone call activities&lt;/span&gt;
 &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;class&lt;/span&gt; PhoneCallListener &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;extends&lt;/span&gt; PhoneStateListener &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;boolean&lt;/span&gt; isPhoneCalling &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; LOG_TAG &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: blue;&quot;&gt;&quot;LOGGING 123&quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  @Override
  &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;void&lt;/span&gt; onCallStateChanged&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;int&lt;/span&gt; state, &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; incomingNumber&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;TelephonyManager.&lt;span style=&quot;color: #006633;&quot;&gt;CALL_STATE_RINGING&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; state&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// phone ringing&lt;/span&gt;
    Log.&lt;span style=&quot;color: #006633;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;LOG_TAG, &lt;span style=&quot;color: blue;&quot;&gt;&quot;RINGING, number: &quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; incomingNumber&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;TelephonyManager.&lt;span style=&quot;color: #006633;&quot;&gt;CALL_STATE_OFFHOOK&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; state&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// active&lt;/span&gt;
    Log.&lt;span style=&quot;color: #006633;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;LOG_TAG, &lt;span style=&quot;color: blue;&quot;&gt;&quot;OFFHOOK&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    isPhoneCalling &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;TelephonyManager.&lt;span style=&quot;color: #006633;&quot;&gt;CALL_STATE_IDLE&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;==&lt;/span&gt; state&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// run when class initial and phone call ended, &lt;/span&gt;
    &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// need detect flag from CALL_STATE_OFFHOOK&lt;/span&gt;
    Log.&lt;span style=&quot;color: #006633;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;LOG_TAG, &lt;span style=&quot;color: blue;&quot;&gt;&quot;IDLE&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;isPhoneCalling&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
&amp;nbsp;
     Log.&lt;span style=&quot;color: #006633;&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;LOG_TAG, &lt;span style=&quot;color: blue;&quot;&gt;&quot;restart app&quot;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
     &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// restart app&lt;/span&gt;
     Intent i &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; getBaseContext&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getPackageManager&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;
      .&lt;span style=&quot;color: #006633;&quot;&gt;getLaunchIntentForPackage&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;
       getBaseContext&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getPackageName&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
     i.&lt;span style=&quot;color: #006633;&quot;&gt;addFlags&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Intent.&lt;span style=&quot;color: #006633;&quot;&gt;FLAG_ACTIVITY_CLEAR_TOP&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
     startActivity&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;i&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
     isPhoneCalling &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
   &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
 &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Update Android Manifest file again,&amp;nbsp;&lt;code style=&quot;background-color: #f7f7f9; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 1px solid rgb(225, 225, 232); color: #0f3b68; font-family: Menlo, Monaco, Consolas, &#39;Courier New&#39;, monospace; font-size: 13px; padding: 2px 4px;&quot;&gt;PhoneStateListener&lt;/code&gt;&amp;nbsp;need&amp;nbsp;&lt;strong&gt;READ_PHONE_STATE&lt;/strong&gt;&amp;nbsp;permission.&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;xml&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.permission.READ_PHONE_STATE&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
&lt;em&gt;File : AndroidManifest.xml&lt;/em&gt;&lt;/div&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;xml&quot; style=&quot;background-color: whitesmoke; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.148438); color: #333333; font-size: 12.950000000000001px; line-height: 1.5; padding: 10px !important; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;encoding&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;manifest&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;xmlns:android&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;http://schemas.android.com/apk/res/android&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;package&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;com.mkyong.android&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:versionCode&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;    &lt;span style=&quot;color: #000066;&quot;&gt;android:versionName&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;1.0&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-sdk&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:minSdkVersion&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;10&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.permission.CALL_PHONE&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;uses-permission&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.permission.READ_PHONE_STATE&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;application&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:icon&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@drawable/ic_launcher&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;        &lt;span style=&quot;color: #000066;&quot;&gt;android:label&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@string/app_name&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
        &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;activity&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;            &lt;span style=&quot;color: #000066;&quot;&gt;android:label&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;@string/app_name&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;            &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;.MainActivity&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;intent-filter&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;action&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.intent.action.MAIN&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
                &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;category&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;android:name&lt;/span&gt;=&lt;span style=&quot;color: red;&quot;&gt;&quot;android.intent.category.LAUNCHER&quot;&lt;/span&gt; &lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;
            &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/intent-filter&amp;gt;&lt;/span&gt;&lt;/span&gt;
        &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/activity&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/application&amp;gt;&lt;/span&gt;&lt;/span&gt;
&amp;nbsp;
&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: black; font-weight: bold;&quot;&gt;&amp;lt;/manifest&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h4 style=&quot;color: #252525; font-family: inherit; font-size: 1.5em; font-weight: normal; line-height: 1.2em; margin: 40px 0px 10px; position: relative; text-rendering: optimizelegibility; text-transform: capitalize;&quot;&gt;
5. Demo&lt;/h4&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
Activity started, just display a button.&lt;/div&gt;
&lt;div class=&quot;pic&quot; style=&quot;background-color: #f9f9f9; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); margin: 20px 0px; padding: 20px; text-align: center;&quot;&gt;
&lt;img alt=&quot;android phone call example&quot; height=&quot;480&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2012/03/android-phone-call-example.png&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.0976563) 1px 1px 5px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; box-shadow: rgba(0, 0, 0, 0.0976563) 1px 1px 5px; max-width: 100%; padding: 5px; vertical-align: middle;&quot; title=&quot;android-phone-call-example&quot; width=&quot;318&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
When button is clicked, make a phone call to 0377778888.&lt;/div&gt;
&lt;div class=&quot;pic&quot; style=&quot;background-color: #f9f9f9; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); margin: 20px 0px; padding: 20px; text-align: center;&quot;&gt;
&lt;img alt=&quot;android phone call example&quot; height=&quot;480&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2012/03/android-phone-call-example-1.png&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.0976563) 1px 1px 5px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; box-shadow: rgba(0, 0, 0, 0.0976563) 1px 1px 5px; max-width: 100%; padding: 5px; vertical-align: middle;&quot; title=&quot;android-phone-call-example-1&quot; width=&quot;318&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 20px;&quot;&gt;
When phone call is hang out or ended, restart the main activity.&lt;/div&gt;
&lt;div class=&quot;pic&quot; style=&quot;background-color: #f9f9f9; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; border: 1px solid rgb(221, 221, 221); margin: 20px 0px; padding: 20px; text-align: center;&quot;&gt;
&lt;img alt=&quot;android phone call example&quot; height=&quot;480&quot; src=&quot;http://www.mkyong.com/wp-content/uploads/2012/03/android-phone-call-example-2.png&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.0976563) 1px 1px 5px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; box-shadow: rgba(0, 0, 0, 0.0976563) 1px 1px 5px; max-width: 100%; padding: 5px; vertical-align: middle;&quot; title=&quot;android-phone-call-example-2&quot; width=&quot;318&quot; /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/4024639526854873776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/4024639526854873776?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4024639526854873776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/4024639526854873776'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/how-to-make-phone-call-in-android.html' title='How To Make A Phone Call In Android'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-342706729171489345</id><published>2012-08-12T10:51:00.002+05:30</published><updated>2012-08-12T10:51:23.601+05:30</updated><title type='text'>Register variables</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Register variables are stored in the CPU registers. Its default value is a garbage value. Scope of a register&lt;br /&gt;
variable is local to the block in which it is defined. Lifetime is till control remains within the block in which the&lt;br /&gt;
register variable is defined. Variable stored in a CPU register can always be accessed faster than the one that is&amp;nbsp;stored in memory. Therefore, if a variable is used at many places in a program, it is better to declare its storage&amp;nbsp;class as register&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
register int x=5;&lt;br /&gt;
Variables for loop counters can be declared as register. Note that register keyword may be ignored by some&lt;br /&gt;
compilers.&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/342706729171489345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/342706729171489345?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/342706729171489345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/342706729171489345'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/register-variables.html' title='Register variables'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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-7196562259138560599.post-7239019843989757149</id><published>2012-08-12T10:50:00.000+05:30</published><updated>2012-08-12T10:50:13.457+05:30</updated><title type='text'>Static variable</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
A static variable is a special variable that is stored in the data segment unlike the default automatic variable that&lt;br /&gt;
is stored in stack. A static variable can be initialized by using keyword static before variable name.&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
static int a = 5;&lt;br /&gt;
A static variable behaves in a different manner depending upon whether it is a global variable or a local variable.&lt;br /&gt;
A static global variable is same as an ordinary global variable except that it cannot be accessed by other files in&amp;nbsp;the same program / project even with the use of keyword extern. A static local variable is different from local&amp;nbsp;variable. It is initialized only once no matter how many times that function in which it resides is called. It may be&amp;nbsp;used as a count variable.&lt;br /&gt;
&lt;b&gt;Example:&lt;/b&gt;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
//program in file f1.c&lt;br /&gt;
void count(void) {&lt;br /&gt;
static int count1 = 0;&lt;br /&gt;
int count2 = 0;&lt;br /&gt;
count1++;&lt;br /&gt;
count2++;&lt;br /&gt;
printf(&quot;\nValue of count1 is %d, Value of count2 is %d&quot;, count1, count2);&lt;br /&gt;
}/&lt;br /&gt;
*Main function*/&lt;br /&gt;
int main(){&lt;br /&gt;
count();&lt;br /&gt;
count();&lt;br /&gt;
count();&lt;br /&gt;
return 0;&lt;br /&gt;
}&lt;br /&gt;
Output:&lt;br /&gt;
Value of count1 is 1, Value of count2 is 1&lt;br /&gt;
Value of count1 is 2, Value of count2 is 1&lt;br /&gt;
Value of count1 is 3, Value of count2 is 1&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vikram-programmingwithjava.blogspot.com/feeds/7239019843989757149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7196562259138560599/7239019843989757149?isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/7239019843989757149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7196562259138560599/posts/default/7239019843989757149'/><link rel='alternate' type='text/html' href='http://vikram-programmingwithjava.blogspot.com/2012/08/static-variable.html' title='Static variable'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00913385744106626019</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>