<?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: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-15825877</id><updated>2012-01-16T22:45:39.601-08:00</updated><title type='text'>Become Master In Java</title><subtitle type='html'>Learn the quick-tips to become Master in Java; Learn the latest in Java; Brush-up fundamentals; Java debugging tips and much more...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>32</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-15825877.post-115336775433852705</id><published>2006-07-19T20:53:00.000-07:00</published><updated>2006-07-19T20:55:54.716-07:00</updated><title type='text'>What's the difference between a queue and a stack?</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;You can create an abstract class that contains only abstract methods. On the other hand, you can create an interface that declares the same methods. So can you use abstract classes instead of interfaces? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Sometimes. But your class may be a descendent of another class and in this case the interface is your only option.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-115336775433852705?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/115336775433852705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=115336775433852705&amp;isPopup=true' title='27 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/115336775433852705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/115336775433852705'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2006/07/whats-difference-between-queue-and.html' title='What&apos;s the difference between a queue and a stack?'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>27</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-115072246154685048</id><published>2006-07-09T06:07:00.000-07:00</published><updated>2006-07-03T21:11:29.026-07:00</updated><title type='text'>What makes a plugin secure?</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;What makes a plugin secure?&lt;br /&gt;Here are some characteristics of a secure plugin:&lt;br /&gt;&lt;br /&gt;1. It is digitally signed by the publisher by a third party issued certificate. This way the user at least knows where the plugin in coming from.&lt;br /&gt;&lt;br /&gt;2. Inform the user of any actions which can lead to any changes in the system before hand and allow user to reject the proposed actions.&lt;br /&gt;&lt;br /&gt;3. Give user the option to save current system settings such that the user can go back to it after the plugin has finished execution if the user so desires.&lt;br /&gt;&lt;br /&gt;Items 2 and 3 above are sometimes the responsiblity of the application installing and using the plugin and not the plugin itself. From the end user perspective they are the same. So the the word plugin here can mean either just the plugin or the plugin together with web application driving it.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;br /&gt;Both java applets and activex components are plugins. Both are written to the disk and saved for future use. ActiveX components can be used by applications other than the web browser while for most practical purposes, java applets can only be used from a web browser (there are stanalone java applet hosting programs out there but they are mostly used by developers and not by end users). The ActiveX component installation requires modification to system registery and hence the end user must have administrative privilege in order to install it while Java applets don't need any adminitrative privilege for installation. One can argue that this makes a signed Java Applet a bigger security threat than an ActiveX component since even a user with minimum previlege can download and run it without the knowledge of the system adminstrator. The only way to avoid this situation is to set the browser to not allow Java Applets all together. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://www.javapeople.blogspot.com/"&gt;&lt;strong&gt;http://www.javapeople.blogspot.com&lt;/strong&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-115072246154685048?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/115072246154685048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=115072246154685048&amp;isPopup=true' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/115072246154685048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/115072246154685048'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2006/07/what-makes-plugin-secure.html' title='What makes a plugin secure?'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-115072225908032152</id><published>2006-06-19T06:02:00.000-07:00</published><updated>2006-06-19T06:04:19.546-07:00</updated><title type='text'>Why would you use a synchronized block vs. synchronized method?</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;A. Synchronized blocks place locks for shorter periods than synchronized methods.&lt;br /&gt;&lt;br /&gt;Explain the usage of the keyword transient?&lt;br /&gt;&lt;br /&gt;A. This keyword indicates that the value of this member variable does not have to be serialized with the object. When the class will be de-serialized, this variable will be initialized with a default value of its data type (i.e. zero for integers).&lt;br /&gt;&lt;br /&gt;How can you force garbage collection?&lt;br /&gt;&lt;br /&gt;A. You can't force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.javapeople.blogspot.com/"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;http://www.javapeople.blogspot.com&lt;/span&gt;&lt;/strong&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-115072225908032152?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/115072225908032152/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=115072225908032152&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/115072225908032152'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/115072225908032152'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2006/06/why-would-you-use-synchronized-block.html' title='Why would you use a synchronized block vs. synchronized method?'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-113746879939435267</id><published>2006-01-16T19:29:00.000-08:00</published><updated>2006-01-23T11:34:13.226-08:00</updated><title type='text'>http://www.javapeople.blogspot.com</title><content type='html'>&lt;span style="color:red;"&gt;&lt;a href="http://javapeople.blogspot.com" target="_blank"&gt;&lt;span style="font-family:verdana;font-size:85%;"&gt;Visit my blog to know more about Java. Like java Frame-Work, Java Interview Questions with Answers and many more resources and information...&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-113746879939435267?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/113746879939435267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=113746879939435267&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/113746879939435267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/113746879939435267'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2006/01/httpwwwjavapeopleblogspotcom.html' title='http://www.javapeople.blogspot.com'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112952281844423543</id><published>2005-10-16T21:20:00.000-07:00</published><updated>2005-10-16T21:20:18.490-07:00</updated><title type='text'>What is the difference between Web Server and Application server? </title><content type='html'>&lt;div class=Section1&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;Webserver serves pages for viewing in web browser, application server provides exposes business logic for client applications through various protocols&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;Webserver exclusively handles http requests. application server serves business logic to application programs through any number of protocols.&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;Webserver delegation model is fairly simple, when the request comes into the webserver, it simply passes the request to the program best able to handle it (Server side program). It may not support transactions and database connection pooling.&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;Application server is more capable of dynamic behavior than webserver. We can also configure application server to work as a webserver.Simply application server is a superset of webserver.&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;Web Server serves static HTML pages&amp;nbsp;or gifs, jpegs, etc., and can also run code written in CGI, JSP etc. A Web server handles the HTTP protocol. Eg of some web server are IIS or apache.&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;An Application Server is used to run business logic or dynamically generated presentation code. It can either be .NET based or J2EE based (BEA WebLogic Server, IBM WebSphere, JBoss).&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;A J2EE application server runs servlets and JSPs (infact a part of the app server called web container is responsible for running servlets and JSPs) that are used to create HTML pages dynamically. In addition, J2EE application server can run EJBs - which are used to execute business logic.&lt;/span&gt;&lt;/font&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style='margin-left:.25in;text-indent:-.25in'&gt;&lt;font size=2 face=Symbol&gt;&lt;span style='font-size:10.0pt;font-family:Symbol'&gt;&amp;middot;&lt;font size=1 face="Times New Roman"&gt;&lt;span style='font:7.0pt "Times New Roman"'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial;color:black'&gt;An Application server has a 'built-in' web server, in addition to that it supports other modules or features like e-business integration, independent management and security module etc.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112952281844423543?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112952281844423543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112952281844423543&amp;isPopup=true' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112952281844423543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112952281844423543'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/10/what-is-difference-between-web-server.html' title='What is the difference between Web Server and Application server? '/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112771051333886464</id><published>2005-10-13T21:50:00.000-07:00</published><updated>2005-10-13T20:53:27.440-07:00</updated><title type='text'>Some More Jave Interview Questions- part3</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;strong&gt;81. What is EJB object ?&lt;/strong&gt;&lt;br /&gt;An object whose class implements the enterprise bean's remote interface. A client never references an enterprise bean instance directly; a client always references an EJB object. The class of an EJB object is generated by a container's deployment tools.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;82. What is EJB server ?&lt;/strong&gt;&lt;br /&gt;Software that provides services to an EJB container. For example, an EJB container typically relies on a transaction manager that is part of the EJB server to perform the two-phase commit across all the participating resource managers. The J2EE architecture assumes that an EJB container is hosted by an EJB server from the same vendor, so it does not specify the contract between these two entities. An EJB server can host one or more EJB containers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;83.&lt;/strong&gt; &lt;strong&gt;What is EJB server provider ?&lt;br /&gt;&lt;/strong&gt;A vendor that supplies an EJB server.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;83. What is EJB server provider ?What is element ?&lt;/strong&gt;&lt;br /&gt;A unit of XML data, delimited by tags. An XML element can enclose other elements.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;84. What is empty tag ?&lt;/strong&gt;&lt;br /&gt;A tag that does not enclose any content&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;85. What is enterprise bean ?&lt;br /&gt;&lt;/strong&gt;A J2EE component that implements a business task or business entity and is hosted by an EJB container; either an entity bean, a session bean, or a message-driven bean.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;86. What is enterprise bean provider ?&lt;br /&gt;&lt;/strong&gt;An application developer who produces enterprise bean classes, remote and home interfaces, and deployment descriptor files, and packages them in an EJB JAR file.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;87. What is enterprise information system ?&lt;/strong&gt;&lt;br /&gt;The applications that constitute an enterprise's existing system for handling companywide information. These applications provide an information infrastructure for an enterprise. An enterprise information system offers a well-defined set of services to its clients. These services are exposed to clients as local or remote interfaces or both. Examples of enterprise information systems include enterprise resource planning systems, mainframe transaction processing systems, and legacy database systems.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;88. What is enterprise information system resource ?&lt;br /&gt;&lt;/strong&gt;An entity that provides enterprise information system-specific functionality to its clients. Examples are a record or set of records in a database system, a business object in an enterprise resource planning system, and a transaction program in a transaction processing system.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;89. What is Enterprise JavaBeans (EJB) ?&lt;br /&gt;&lt;/strong&gt;A component architecture for the development and deployment of object-oriented, distributed, enterprise-level applications. Applications written using the Enterprise JavaBeans architecture are scalable, transactional, and secure.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;90. What is Enterprise JavaBeans Query Language (EJB QL) ?&lt;br /&gt;&lt;/strong&gt;Defines the queries for the finder and select methods of an entity bean having container-managed persistence. A subset of SQL92, EJB QL has extensions that allow navigation over the relationships defined in an entity bean's abstract schema.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;91. What is an entity ?&lt;br /&gt;&lt;/strong&gt;A distinct, individual item that can be included in an XML document by referencing it. Such an entity reference can name an entity as small as a character (for example, &lt;, which references the less-than symbol or left angle bracket, &lt;). An entity reference can also reference an entire document, an external entity, or a collection of DTD definitions. &lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;92. What is entity bean ?&lt;br /&gt;&lt;/strong&gt;An enterprise bean that represents persistent data maintained in a database. An entity bean can manage its own persistence or can delegate this function to its container. An entity bean is identified by a primary key. If the container in which an entity bean is hosted crashes, the entity bean, its primary key, and any remote references survive the crash.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;93. What is entity reference ?&lt;br /&gt;&lt;/strong&gt;A reference to an entity that is substituted for the reference when the XML document is parsed. It can reference a predefined entity such as &lt;&gt;94. What is error ?&lt;/strong&gt;&lt;br /&gt;A SAX parsing error is generally a validation error; in other words, it occurs when an XML document is not valid, although it can also occur if the declaration specifies an XML version that the parser cannot handle. See also fatal error, warning.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;95. What is Extensible Markup Language ?&lt;/strong&gt;&lt;br /&gt;XML.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;96. What is external entity ?&lt;br /&gt;&lt;/strong&gt;An entity that exists as an external XML file, which is included in the XML document using an entity reference.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;96. What is external subset ?&lt;br /&gt;&lt;/strong&gt;That part of a DTD that is defined by references to external DTD files.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;97. What is fatal error ?&lt;br /&gt;&lt;/strong&gt;A fatal error occurs in the SAX parser when a document is not well formed or otherwise cannot be processed. See also error, warning.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;98. What is filter ?&lt;/strong&gt;&lt;br /&gt;An object that can transform the header or content (or both) of a request or response. Filters differ from Web components in that they usually do not themselves create responses but rather modify or adapt the requests for a resource, and modify or adapt responses from a resource. A filter should not have any dependencies on a Web resource for which it is acting as a filter so that it can be composable with more than one type of Web resource.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;99. What is filter chain ?&lt;br /&gt;&lt;/strong&gt;A concatenation of XSLT transformations in which the output of one transformation becomes the input of the next.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;100. What is finder method ?&lt;br /&gt;&lt;/strong&gt;A method defined in the home interface and invoked by a client to locate an entity bean.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112771051333886464?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112771051333886464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112771051333886464&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112771051333886464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112771051333886464'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/10/some-more-jave-interview-questions_14.html' title='Some More Jave Interview Questions- part3'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112893727299914926</id><published>2005-10-10T02:41:00.000-07:00</published><updated>2005-10-10T02:41:13.726-07:00</updated><title type='text'>JDBC - ODBC Questions......</title><content type='html'>&lt;div class=Section1&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;1. What's the JDBC 2.0 API?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;The JDBC 2.0 API is the latest update of the JDBC API. It contains many new features, including scrollable result sets and the new SQL:1999 (formerly SQL 3) data types. There are two parts to the JDBC 2.0 API: &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;the JDBC 2.0 core API (the java.sql package), which is included in the JavaTM 2 SDK, Standard Edition &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;the JDBC 2.0 Optional Package API (the javax.sql package), which is available separately or as part of the Java 2 SDK, Enterprise Edition &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;2. Does the JDBC-ODBC Bridge support the new features in the JDBC 2.0 API?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No, the JDBC-ODBC Bridge that is included in the Java 2 Platform initial release does not support the new features in the JDBC 2.0 API. However, Sun and Merant are working to produce a new version of the Bridge that does support the new features. Note that we do not recommend using the Bridge except for experimental purposes or when you have no other driver available. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;3. Can the JDBC-ODBC Bridge be used with applets?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Use of the JDBC-ODBC bridge from an untrusted applet running in a browser, such as Netscape Navigator, isn't allowed. The JDBC-ODBC bridge doesn't allow untrusted code to call it for security reasons. This is good because it means that an untrusted applet that is downloaded by the browser can't circumvent Java security by calling ODBC. Remember that ODBC is native code, so once ODBC is called, the Java programming language can't guarantee that a security violation won't occur. On the other hand, Pure Java JDBC drivers work well with applets. They are fully downloadable and do not require any client-side configuration. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Finally, we would like to note that it is possible to use the JDBC-ODBC bridge with applets that will be run in appletviewer since appletviewer assumes that applets are trusted. It is also possible to use the JDBC-ODBC bridge with applets that are run in the HotJavaTM browser (available from Java Software), since HotJava provides an option to turn off applet security. In general, it is dangerous to turn applet security off, but it may be appropriate in certain controlled situations, such as for applets that will only be used in a secure intranet environment. Remember to exercise caution if you choose this option, and use an all-Java JDBC driver whenever possible to avoid security problems.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;4. How do I start debugging problems related to the JDBC API?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;A good way to find out what JDBC calls are doing is to enable JDBC tracing. The JDBC trace contains a detailed listing of the activity occurring in the system that is related to JDBC operations. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;If you use the DriverManager facility to establish your database connection, you use the DriverManager.setLogWriter method to enable tracing of JDBC operations. If you use a DataSource object to get a connection, you use the DataSource.setLogWriter method to enable tracing. (For pooled connections, you use the ConnectionPoolDataSource.setLogWriter method, and for connections that can participate in distributed transactions, you use the XADataSource.setLogWriter method.) &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;5. How can I use the JDBC API to access a desktop database like Microsoft Access over the network?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Most desktop databases currently require a JDBC solution that uses ODBC underneath. This is because the vendors of these database products haven't implemented all-Java JDBC drivers. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;The best approach is to use a commercial JDBC driver that supports ODBC and the database you want to use. See the &lt;u&gt;&lt;font color=blue&gt;&lt;span style='color:blue'&gt;JDBC drivers page&lt;/span&gt;&lt;/font&gt;&lt;/u&gt; for a list of available JDBC drivers. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;The JDBC-ODBC bridge from Sun's Java Software does not provide network access to desktop databases by itself. The JDBC-ODBC bridge loads ODBC as a local DLL, and typical ODBC drivers for desktop databases like Access aren't networked. The JDBC-ODBC bridge can be used together with the &lt;u&gt;&lt;font color=blue&gt;&lt;span style='color:blue'&gt;RMI-JDBC bridge&lt;/span&gt;&lt;/font&gt;&lt;/u&gt; , however, to access a desktop database like Access over the net. This RMI-JDBC-ODBC solution is free. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;6. Does the JDK include the JDBC API and the JDBC-ODBC Bridge?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Yes, the JDK 1.1 and the Java 2 SDK, Standard Edition (formerly known as the JDK 1.2), contain both the JDBC API and the JDBC-ODBC Bridge. The Java 2 SDK, Standard Edition, contains the JDBC 2.0 core API, which is the latest version. It does not include the JDBC 2.0 Optional Package, which is part of the Java 2 SDK, Enterprise Edition, or which you can download separately. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Note that the version of the JDBC API and the JDBC-ODBC Bridge provided for separate download on the JDBC download page are only for use with the JDK 1.0.2.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;7. What JDBC technology-enabled drivers are available?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size: 10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;See our &lt;u&gt;&lt;font color=blue&gt;&lt;span style='color:blue'&gt;web page on JDBC technology-enabled drivers&lt;/span&gt;&lt;/font&gt;&lt;/u&gt; for a current listing. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;8. What documentation is available for the JDBC API?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;See the &lt;u&gt;&lt;font color=blue&gt;&lt;span style='color:blue'&gt;JDBC technology home page&lt;/span&gt;&lt;/font&gt;&lt;/u&gt; for links to information about JDBC technology. This page links to information about features and benefits, a list of new features, a section on getting started, online tutorials, a section on driver requirements, and other information in addition to the specifications and javadoc documentation.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;9. Are there any ODBC drivers that do not work with the JDBC-ODBC Bridge?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Most ODBC 2.0 drivers should work with the Bridge. Since there is some variation in functionality between ODBC drivers, the functionality of the bridge may be affected. The bridge works with popular PC databases, such as Microsoft Access and FoxPro.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;10. Does the JDBC-ODBC Bridge work with Microsoft J++?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No, J++ does not support the JDBC-ODBC bridge since it doesn't implement the Java Native Interface (JNI). Any all-Java JDBC driver should work with J++, however.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;11. What causes the &amp;quot;No suitable driver&amp;quot; error?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;&amp;quot;No suitable driver&amp;quot; is an error that usually occurs during a call to the DriverManager.getConnection method. The cause can be failing to load the appropriate JDBC drivers before calling the getConnection method, or it can be specifying an invalid JDBC URL--one that isn't recognized by your JDBC driver. Your best bet is to check the documentation for your JDBC driver or contact your JDBC driver vendor if you suspect that the URL you are specifying is not being recognized by your JDBC driver. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;In addition, when you are using the JDBC-ODBC Bridge, this error can occur if one or more the the shared libraries needed by the Bridge cannot be loaded. If you think this is the cause, check your configuration to be sure that the shared libraries are accessible to the Bridge.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;12. Why isn't the java.sql.DriverManager class being found?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;This problem can be caused by running a JDBC applet in a browser that supports the JDK 1.0.2, such as Netscape Navigator 3.0. The JDK 1.0.2 does not contain the JDBC API, so the DriverManager class typically isn't found by the Java virtual machine running in the browser. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Here's a solution that doesn't require any additional configuration of your web clients. Remember that classes in the java.* packages cannot be downloaded by most browsers for security reasons. Because of this, many vendors of all-Java JDBC drivers supply versions of the java.sql.* classes that have been renamed to jdbc.sql.*, along with a version of their driver that uses these modified classes. If you import jdbc.sql.* in your applet code instead of java.sql.*, and add the jdbc.sql.* classes provided by your JDBC driver vendor to your applet's codebase, then all of the JDBC classes needed by the applet can be downloaded by the browser at run time, including the DriverManager class. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;This solution will allow your applet to work in any client browser that supports the JDK 1.0.2. Your applet will also work in browsers that support the JDK 1.1, although you may want to switch to the JDK 1.1 classes for performance reasons. Also, keep in mind that the solution outlined here is just an example and that other solutions are possible. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;13. Why doesn't calling the method Class.forName load my JDBC driver?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;There is a bug in the JDK 1.1.x that can cause the method Class.forName to fail. A workaround is to explicitly call the method DriverManager.registerDriver(new YourDriverClass()). The exact problem in the JDK is a race condition in the class loader that prevents the static section of code in the driver class from executing and registering the driver with the DriverManager. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;14. Why do the java.sql and java.math packages fail to download java.* packages? Is there a workaround?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;For security reasons, browsers will not download java.* packages. In order to use the JDBC API with browsers that have not been upgraded to JDK1.1 or beyond, we recommend that the java.sql and java.math packages be renamed jdbc.sql and jdbc.math. Most vendors supplying JDBC technology-enabled drivers that are written purely in the Java programming language already provide versions of these renamed packages. When JDK 1.1 support has been added to your browser, you should convert your applets back to the java.* package names.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;15. Why is the precision of java.math.BigDecimal limited to 18 digits in the JDK 1.0.2 add-on version of the JDBC API?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;In JDK 1.1, java.math.BigInteger is implemented in C. It supports a precision of thousands of digits. The same is true for BigDecigmal. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;The version of BigInteger provided with the JDK 1.0.2 add-on version of the JDBC API is a simplified version written in the Java programming language, and it is limited to 18 digits. Because the implementation of BigDecimal is based on BigInteger, it also is limited to this precision. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;In the JDBC 2.0 API, you can use a new version of the method ResultSet.getBigDecimal that does not take a scale parameter and returns a BigDecimal with full precision.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;16. Can the JDBC API be added to JDK 1.0.2?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Yes. &lt;u&gt;&lt;font color=blue&gt;&lt;span style='color:blue'&gt;Download the JDBC 1.22 API from the JDBC download page&lt;/span&gt;&lt;/font&gt;&lt;/u&gt; and follow the installation instructions in the release notes. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;If you are using any version of the JDK from 1.1 on, the JDBC API is already included, and you should not download the JDBC 1.22 API.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;17. How do I retrieve a whole row of data at once, instead of calling an individual ResultSet.getXXX method for each column?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;The ResultSet.getXXX methods are the only way to retrieve data from a ResultSet object, which means that you have to make a method call for each column of a row. It is unlikely that this is the cause of a performance problem, however, because it is difficult to see how a column could be fetched without at least the cost of a function call in any scenario. We welcome input from developers on this issue.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;18. Why does the ODBC driver manager return 'Data source name not found and no default driver specified Vendor: 0'&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;This type of error occurs during an attempt to connect to a database with the bridge. First, note that the error is coming from the ODBC driver manager. This indicates that the bridge-which is a normal ODBC client-has successfully called ODBC, so the problem isn't due to native libraries not being present. In this case, it appears that the error is due to the fact that an ODBC DSN (data source name) needs to be configured on the client machine. Developers often forget to do this, thinking that the bridge will magically find the DSN they configured on their remote server machine&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;19. Are all the required JDBC drivers to establish connectivity to my database part of the JDK?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No. There aren't any JDBC technology-enabled drivers bundled with the JDK 1.1.x or Java 2 Platform releases other than the JDBC-ODBC Bridge. So, developers need to get a driver and install it before they can connect to a database. We are considering bundling JDBC technology- enabled drivers in the future.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;20. Is the JDBC-ODBC Bridge multi-threaded?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No. The JDBC-ODBC Bridge does not support concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won't get the advantages of multi-threading. In addition, deadlocks can occur between locks held in the database and the semaphore used by the Bridge. We are thinking about removing the synchronized methods in the future. They were added originally to make things simple for folks writing Java programs that use a single-threaded ODBC driver.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;21. Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No. You can open only one Statement object per connection when you are using the JDBC-ODBC Bridge.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;22. Does the JDBC-ODBC Bridge developed by Merant and Sun support result sets that contain Japanese Characters (DBCS)?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Yes, but we haven't tested this ourselves. The version of the Bridge in the Java 2 SDK, Standard Edition, and Java 2 SDK, Enterprise Edition, also supports a new charSet Connection property for specifying the character encoding used by the underlying DBMS.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;23. Why can't I invoke the ResultSet methods afterLast and beforeFirst when the method next works?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;You are probably using a driver implemented for the JDBC 1.0 API. You need to upgrade to a JDBC 2.0 driver that implements scrollable result sets. Also be sure that your code has created scrollable result sets and that the DBMS you are using supports them.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;24. How can I retrieve a String or other object type without creating a new object each time?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;Creating and garbage collecting potentially large numbers of objects (millions) unnecessarily can really hurt performance. It may be better to provide a way to retrieve data like strings using the JDBC API without always allocating a new object. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;We are studying this issue to see if it is an area in which the JDBC API should be improved. Stay tuned, and please send us any comments you have on this question.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;25. There is a method getColumnCount in the JDBC API. Is there a similar method to find the number of rows in a result set?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No, but it is easy to find the number of rows. If you are using a scrollable result set, rs, you can call the methods rs.last and then rs.getRow to find out how many rows rs has. If the result is not scrollable, you can either count the rows by iterating through the result set or get the number of rows by submitting a query with a COUNT column in the SELECT clause.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;26. I would like to download the JDBC-ODBC Bridge for the Java 2 SDK, Standard Edition (formerly JDK 1.2). I'm a beginner with the JDBC API, and I would like to start with the Bridge. How do I do it?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;The JDBC-ODBC Bridge is bundled with the Java 2 SDK, Standard Edition, so there is no need to download it separately.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;27. If I use the JDBC API, do I have to use ODBC underneath?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;No, this is just one of many possible solutions. We recommend using a pure Java JDBC technology-enabled driver, type 3 or 4, in order to get all of the benefits of the Java programming language and the JDBC API.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial;font-weight:bold'&gt;28. Once I have the Java 2 SDK, Standard Edition, from Sun, what else do I need to connect to a database?&lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt;font-family:Arial'&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;You still need to get and install a JDBC technology-enabled driver that supports the database that you are using. There are many drivers available from a variety of sources. You can also try using the JDBC-ODBC Bridge if you have ODBC connectivity set up already. The Bridge comes with the Java 2 SDK, Standard Edition, and Enterprise Edition, and it doesn't require any extra setup itself. The Bridge is a normal ODBC client. Note, however, that you should use the JDBC-ODBC Bridge only for experimental prototyping or when you have no other driver available.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal&gt;&lt;font size=2 face=Arial&gt;&lt;span style='font-size:10.0pt; font-family:Arial'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112893727299914926?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112893727299914926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112893727299914926&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112893727299914926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112893727299914926'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/10/jdbc-odbc-questions.html' title='JDBC - ODBC Questions......'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112771003008431077</id><published>2005-10-06T21:39:00.000-07:00</published><updated>2005-10-06T21:49:55.413-07:00</updated><title type='text'>Some More Jave Interview Questions- part2</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;strong&gt;41. What is commit ?&lt;/strong&gt;&lt;br /&gt;The point in a transaction when all updates to any resources involved in the transaction are made permanent.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;42. What is component contract ?&lt;/strong&gt;&lt;br /&gt;The contract between a J2EE component and its container. The contract includes life-cycle management of the component, a context interface that the instance uses to obtain various information and services from its container, and a list of services that every container must provide for its components.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;43. What is component-managed sign-on ?&lt;/strong&gt;&lt;br /&gt;A mechanism whereby security information needed for signing on to a resource is provided by an application component.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;44. What is connector ?&lt;/strong&gt;&lt;br /&gt;A standard extension mechanism for containers that provides connectivity to enterprise information systems. A connector is specific to an enterprise information system and consists of a resource adapter and application development tools for enterprise information system connectivity. The resource adapter is plugged in to a container through its support for system-level contracts defined in the Connector architecture.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;45. What is Connector architecture ?&lt;/strong&gt;&lt;br /&gt;An architecture for integration of J2EE products with enterprise information systems. There are two parts to this architecture: a resource adapter provided by an enterprise information system vendor and the J2EE product that allows this resource adapter to plug in. This architecture defines a set of contracts that a resource adapter must support to plug in to a J2EE product-for example, transactions, security, and resource management.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;46. What is container ?&lt;/strong&gt;&lt;br /&gt;An entity that provides life-cycle management, security, deployment, and runtime services to J2EE components. Each type of container (EJB, Web, JSP, servlet, applet, and application client) also provides component-specific services.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;47. What is container-managed persistence ?&lt;br /&gt;&lt;/strong&gt;The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean's container.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;48. What is container-managed sign-on ?&lt;/strong&gt;&lt;br /&gt;The mechanism whereby security information needed for signing on to a resource is supplied by the container.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;49. What is container-managed transaction ?&lt;br /&gt;&lt;/strong&gt;A transaction whose boundaries are defined by an EJB container. An entity bean must use container-managed transactions.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;50. What is content ?&lt;/strong&gt;&lt;br /&gt;In an XML document, the part that occurs after the prolog, including the root element and everything it contains.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;51. What is context attribute ?&lt;br /&gt;&lt;/strong&gt;An object bound into the context associated with a servlet.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;52. What is context root ?&lt;br /&gt;&lt;/strong&gt;A name that gets mapped to the document root of a Web application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;53. What is conversational state ?&lt;/strong&gt;&lt;br /&gt;The field values of a session bean plus the transitive closure of the objects reachable from the bean's fields. The transitive closure of a bean is defined in terms of the serialization protocol for the Java programming language, that is, the fields that would be stored by serializing the bean instance.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;54. What is CORBA ?&lt;/strong&gt;&lt;br /&gt;Common Object Request Broker Architecture. A language-independent distributed object model specified by the OMG.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;55. What is create method ?&lt;/strong&gt;&lt;br /&gt;A method defined in the home interface and invoked by a client to create an enterprise bean.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;56. What is credentials ?&lt;/strong&gt;&lt;br /&gt;The information describing the security attributes of a principal.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;57. What is CSS ?&lt;/strong&gt;&lt;br /&gt;Cascading style sheet. A stylesheet used with HTML and XML documents to add a style to all elements marked with a particular tag, for the direction of browsers or other presentation mechanisms.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;58. What is CTS ?&lt;br /&gt;&lt;/strong&gt;Compatibility test suite. A suite of compatibility tests for verifying that a J2EE product complies with the J2EE platform specification.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;59. What is data ?&lt;/strong&gt;&lt;br /&gt;The contents of an element in an XML stream, generally used when the element does not contain any subelements. When it does, the term content is generally used. When the only text in an XML structure is contained in simple elements and when elements that have subelements have little or no data mixed in, then that structure is often thought of as XML data, as opposed to an XML document.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;60. What is DDP ?&lt;br /&gt;&lt;/strong&gt;Document-driven programming. The use of XML to define applications.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;61. What is declaration ?&lt;br /&gt;&lt;/strong&gt;The very first thing in an XML document, which declares it as XML. The minimal declaration is . The declaration is part of the document prolog.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;62. What is declarative security ?&lt;/strong&gt;&lt;br /&gt;Mechanisms used in an application that are expressed in a declarative syntax in a deployment descriptor.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;63. What is delegation ?&lt;br /&gt;&lt;/strong&gt;An act whereby one principal authorizes another principal to use its identity or privileges with some restrictions.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;64. What is deployer ?&lt;br /&gt;&lt;/strong&gt;A person who installs J2EE modules and applications into an operational environment.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;65. What is deployment ?&lt;/strong&gt;&lt;br /&gt;The process whereby software is installed into an operational environment.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;66. What is deployment descriptor ?&lt;/strong&gt;&lt;br /&gt;An XML file provided with each module and J2EE application that describes how they should be deployed. The deployment descriptor directs a deployment tool to deploy a module or application with specific container options and describes specific configuration requirements that a deployer must resolve.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;67. What is destination ?&lt;/strong&gt;&lt;br /&gt;A JMS administered object that encapsulates the identity of a JMS queue or topic. See point-to-point messaging system, publish/subscribe messaging system.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;68. What is digest authentication ?&lt;/strong&gt;&lt;br /&gt;An authentication mechanism in which a Web application authenticates itself to a Web server by sending the server a message digest along with its HTTP request message. The digest is computed by employing a one-way hash algorithm to a concatenation of the HTTP request message and the client's password. The digest is typically much smaller than the HTTP request and doesn't contain the password.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;69. What is distributed application ?&lt;/strong&gt;&lt;br /&gt;An application made up of distinct components running in separate runtime environments, usually on different platforms connected via a network. Typical distributed applications are two-tier (client-server), three-tier (client-middleware-server), and multitier (client-multiple middleware-multiple servers).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;67. What is document ?&lt;/strong&gt;&lt;br /&gt;In general, an XML structure in which one or more elements contains text intermixed with subelements.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;68. What is Document Object Model ?&lt;br /&gt;&lt;/strong&gt;An API for accessing and manipulating XML documents as tree structures. DOM provides platform-neutral, language-neutral interfaces that enables programs and scripts to dynamically access and modify content and structure in XML documents.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;69. What is document root ?&lt;/strong&gt;&lt;br /&gt;The top-level directory of a WAR. The document root is where JSP pages, client-side classes and archives, and static Web resources are stored.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;70. What is DTD ?&lt;/strong&gt;&lt;br /&gt;Document type definition. An optional part of the XML document prolog, as specified by the XML standard. The DTD specifies constraints on the valid tags and tag sequences that can be in the document. The DTD has a number of shortcomings, however, and this has led to various schema proposals. For example, the DTD entry says that the XML element called username contains parsed character data-that is, text alone, with no other structural elements under it. The DTD includes both the local subset, defined in the current file, and the external subset, which consists of the definitions contained in external DTD files that are referenced in the local subset using a parameter entity.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;71. What is durable subscription ?&lt;/strong&gt;&lt;br /&gt;In a JMS publish/subscribe messaging system, a subscription that continues to exist whether or not there is a current active subscriber object. If there is no active subscriber, the JMS provider retains the subscription's messages until they are received by the subscription or until they expire.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;72. What is EAR file ?&lt;/strong&gt;&lt;br /&gt;Enterprise Archive file. A JAR archive that contains a J2EE application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;73. What is ebXML ?&lt;/strong&gt;&lt;br /&gt;Electronic Business XML. A group of specifications designed to enable enterprises to conduct business through the exchange of XML-based messages. It is sponsored by OASIS and the United Nations Centre for the Facilitation of Procedures and Practices in Administration, Commerce and Transport (U.N./CEFACT).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;74. What is EJB ?&lt;/strong&gt;&lt;br /&gt;Enterprise JavaBeans.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;75. What is EJB container ?&lt;br /&gt;&lt;/strong&gt;A container that implements the EJB component contract of the J2EE architecture. This contract specifies a runtime environment for enterprise beans that includes security, concurrency, life-cycle management, transactions, deployment, naming, and other services. An EJB container is provided by an EJB or J2EE server.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;76. What is EJB container provider ?&lt;br /&gt;&lt;/strong&gt;A vendor that supplies an EJB container.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;77. What is EJB context ?&lt;/strong&gt;&lt;br /&gt;A vendor that supplies an EJB container. An object that allows an enterprise bean to invoke services provided by the container and to obtain the information about the caller of a client-invoked method.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;78. What is EJB home object ?&lt;br /&gt;&lt;/strong&gt;An object that provides the life-cycle operations (create, remove, find) for an enterprise bean. The class for the EJB home object is generated by the container's deployment tools. The EJB home object implements the enterprise bean's home interface. The client references an EJB home object to perform life-cycle operations on an EJB object. The client uses JNDI to locate an EJB home object&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;79. What is EJB JAR file ?&lt;br /&gt;&lt;/strong&gt;A JAR archive that contains an EJB module.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;80. What is EJB module ?&lt;br /&gt;&lt;/strong&gt;A deployable unit that consists of one or more enterprise beans and an EJB deployment descriptor.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112771003008431077?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112771003008431077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112771003008431077&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112771003008431077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112771003008431077'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/10/some-more-jave-interview-questions_07.html' title='Some More Jave Interview Questions- part2'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112770952362192288</id><published>2005-10-03T21:30:00.000-07:00</published><updated>2005-10-03T21:26:24.346-07:00</updated><title type='text'>Some More Jave Interview Questions- part1</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;strong&gt;1. What is J2EE?&lt;br /&gt;&lt;/strong&gt;J2EE is an environment for developing and deploying enterprise applications. The J2EE platform consists of a set of services, application programming interfaces (APIs), and protocols that provide the functionality for developing multitiered, web-based applications.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. What is the J2EE module?&lt;/strong&gt;&lt;br /&gt;A J2EE module consists of one or more J2EE components for the same container type and one component deployment descriptor of that type.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. What are the components of J2EE application? &lt;/strong&gt;&lt;br /&gt;A J2EE component is a self-contained functional software unit that is assembled into a J2EE application with its related classes and files and communicates with other components. The J2EE specification defines the following J2EE components:&lt;br /&gt;Application clients and applets are client components.&lt;br /&gt;Java Servlet and JavaServer PagesTM (JSPTM) technology components are web components.&lt;br /&gt;Enterprise JavaBeansTM (EJBTM) components (enterprise beans) are business components.&lt;br /&gt;Resource adapter components provided by EIS and tool vendors.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;4. What are the four types of J2EE modules?&lt;br /&gt;&lt;/strong&gt;1. Application client module&lt;br /&gt;2. Web module&lt;br /&gt;3. Enterprise JavaBeans module&lt;br /&gt;4. Resource adapter module&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. What does application client module contain? &lt;/strong&gt;&lt;br /&gt;The application client module contains:&lt;br /&gt;--class files,&lt;br /&gt;--an application client deployment descriptoor.&lt;br /&gt;Application client modules are packaged as JAR files with a .jar extension.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;6. What does web module contain?&lt;br /&gt;&lt;/strong&gt;The web module contains:&lt;br /&gt;--JSP files,&lt;br /&gt;--class files for servlets,&lt;br /&gt;--GIF and HTML files, and&lt;br /&gt;--a Web deployment descriptor.&lt;br /&gt;Web modules are packaged as JAR files with a .war (Web ARchive) extension.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7. What are the differences between Ear, Jar and War files? Under what circumstances should we use each one? &lt;/strong&gt;&lt;br /&gt;There are no structural differences between the files; they are all archived using zip-jar compression. However, they are intended for different purposes.&lt;br /&gt;--Jar files (files with a .jar extension) arre intended to hold generic libraries of Java classes, resources, auxiliary files, etc.&lt;br /&gt;--War files (files with a .war extension) arre intended to contain complete Web applications. In this context, a Web application is defined as a single group of files, classes, resources, .jar files that can be packaged and accessed as one servlet context.&lt;br /&gt;--Ear files (files with a .ear extension) arre intended to contain complete enterprise applications. In this context, an enterprise application is defined as a collection of .jar files, resources, classes, and multiple Web applications.&lt;br /&gt;Each type of file (.jar, .war, .ear) is processed uniquely by application servers, servlet containers, EJB containers, etc.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;8. What is the difference between Session bean and Entity bean?one?&lt;br /&gt;&lt;/strong&gt;The Session bean and Entity bean are two main parts of EJB container.&lt;br /&gt;Session Bean&lt;br /&gt;--represents a workflow on behalf of a cliennt&lt;br /&gt;--one-to-one logical mapping to a client. --created and destroyed by a client&lt;br /&gt;--not permanent objects&lt;br /&gt;--lives its EJB container(generally) does noot survive system shut down&lt;br /&gt;--two types: stateless and stateful beans Entity Bean&lt;br /&gt;--represents persistent data and behavior off this data&lt;br /&gt;--can be shared among multiple clients&lt;br /&gt;--persists across multiple invocations&lt;br /&gt;--findable permanent objects&lt;br /&gt;--outlives its EJB container, survives systeem shutdown&lt;br /&gt;--two types: container managed persistence(CCMP) and bean managed persistence(BMP)&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;9. What is "applet" ?&lt;/strong&gt;&lt;br /&gt;A J2EE component that typically executes in a Web browser but can execute in a variety of other applications or devices that support the applet programming model.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;10. What is "applet container" ?&lt;br /&gt;&lt;/strong&gt;A container that includes support for the applet programming model.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;11. What is "application assembler" ?&lt;/strong&gt;&lt;br /&gt;A person who combines J2EE components and modules into deployable application units.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;12. What is "application client" ?&lt;/strong&gt;&lt;br /&gt;A first-tier J2EE client component that executes in its own Java virtual machine. Application clients have access to some J2EE platform APIs.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;13. What is "application client container" ?&lt;/strong&gt;&lt;br /&gt;A container that supports application client components.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;14. What is "application client module" ?&lt;/strong&gt;&lt;br /&gt;A software unit that consists of one or more classes and an application client deployment descriptor.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;15. What is "application component provider" ?&lt;br /&gt;&lt;/strong&gt;A vendor that provides the Java classes that implement components' methods, JSP page definitions, and any required deployment descriptors.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;16. What is "application configuration resource file" ?&lt;/strong&gt;&lt;br /&gt;An XML file used to configure resources for a JavaServer Faces application, to define navigation rules for the application, and to register converters, validators, listeners, renderers, and components with the application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;17. What is "archiving" ?&lt;/strong&gt;&lt;br /&gt;The process of saving the state of an object and restoring it.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;18. What is "asant" ?&lt;br /&gt;&lt;/strong&gt;A Java-based build tool that can be extended using Java classes. The configuration files are XML-based, calling out a target tree where various tasks get executed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;19. What is "attribute"What is "asant" ?&lt;/strong&gt;&lt;br /&gt;A qualifier on an XML tag that provides additional information.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;20. What is authentication ?&lt;br /&gt;&lt;/strong&gt;The process that verifies the identity of a user, device, or other entity in a computer system, usually as a prerequisite to allowing access to resources in a system. The Java servlet specification requires three types of authentication-basic, form-based, and mutual-and supports digest authentication.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;21. What is authorization?&lt;br /&gt;&lt;/strong&gt;The process by which access to a method or resource is determined. Authorization depends on the determination of whether the principal associated with a request through authentication is in a given security role. A security role is a logical grouping of users defined by the person who assembles the application. A deployer maps security roles to security identities. Security identities may be principals or groups in the operational environment.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;22. What is authorization constraint ?&lt;/strong&gt;&lt;br /&gt;An authorization rule that determines who is permitted to access a Web resource collection.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;23. What is B2B ?&lt;/strong&gt;&lt;br /&gt;B2B stands for Business-to-business.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;24. What is backing bean ?&lt;/strong&gt;&lt;br /&gt;A JavaBeans component that corresponds to a JSP page that includes JavaServer Faces components. The backing bean defines properties for the components on the page and methods that perform processing for the component. This processing includes event handling, validation, and processing associated with navigation.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;25. What is basic authentication ?&lt;/strong&gt;&lt;br /&gt;An authentication mechanism in which a Web server authenticates an entity via a user name and password obtained using the Web application's built-in authentication mechanism.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;26. What is bean-managed persistence ?&lt;/strong&gt;&lt;br /&gt;The mechanism whereby data transfer between an entity bean's variables and a resource manager is managed by the entity bean.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;27. What is bean-managed transaction ?&lt;/strong&gt;&lt;br /&gt;A transaction whose boundaries are defined by an enterprise bean.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;28. What is binding (XML) ?&lt;/strong&gt;&lt;br /&gt;Generating the code needed to process a well-defined portion of XML data.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;29. What is binding (JavaServer Faces technology) ?&lt;/strong&gt;&lt;br /&gt;Wiring UI components to back-end data sources such as backing bean properties.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;30. What is build file ?&lt;/strong&gt;&lt;br /&gt;The XML file that contains one or more asant targets. A target is a set of tasks you want to be executed. When starting asant, you can select which targets you want to have executed. When no target is given, the project's default target is executed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;31. What is business logic ?&lt;/strong&gt;&lt;br /&gt;The code that implements the functionality of an application. In the Enterprise JavaBeans architecture, this logic is implemented by the methods of an enterprise bean.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;32.What is business method ?&lt;/strong&gt;&lt;br /&gt;A method of an enterprise bean that implements the business logic or rules of an application.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;33. What is callback methods ?&lt;/strong&gt;&lt;br /&gt;Component methods called by the container to notify the component of important events in its life cycle.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;34. What is caller ?&lt;/strong&gt;&lt;br /&gt;Same as caller principal.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;35. What is caller principal ?&lt;/strong&gt;&lt;br /&gt;The principal that identifies the invoker of the enterprise bean method.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;36. What is cascade delete ?&lt;/strong&gt;&lt;br /&gt;A deletion that triggers another deletion. A cascade delete can be specified for an entity bean that has container-managed persistence.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;37. What is CDATA ?&lt;/strong&gt;&lt;br /&gt;A predefined XML tag for character data that means "don't interpret these characters," as opposed to parsed character data (PCDATA), in which the normal rules of XML syntax apply. CDATA sections are typically used to show examples of XML syntax.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;38. What is certificate authority ?&lt;/strong&gt;&lt;br /&gt;A trusted organization that issues public key certificates and provides identification to the bearer.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;39. What is client-certificate authentication ?&lt;br /&gt;&lt;/strong&gt;An authentication mechanism that uses HTTP over SSL, in which the server and, optionally, the client authenticate each other with a public key certificate that conforms to a standard that is defined by X.509 Public Key Infrastructure.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;40. What is comment ?&lt;/strong&gt;&lt;br /&gt;In an XML document, text that is ignored unless the parser is specifically told to recognize it.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112770952362192288?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112770952362192288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112770952362192288&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112770952362192288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112770952362192288'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/10/some-more-jave-interview-questions.html' title='Some More Jave Interview Questions- part1'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112696556480452068</id><published>2005-09-22T06:53:00.000-07:00</published><updated>2005-10-02T21:32:07.930-07:00</updated><title type='text'>Java Technology and Web Services</title><content type='html'>&lt;span style="font-family:arial;"&gt;The Web services are Web-based enterprise applications that use open, XML-based standards and transport protocols to exchange data with calling clients. Java 2 Platform, Enterprise Edition (J2EE) provides the APIs and tools you need to create and deploy interoperable Web services and clients.&lt;br /&gt;&lt;br /&gt;Java Technology and Web Services is organized into these subcategories:&lt;br /&gt;Java Web Services Developer Pack (Java WSDP)&lt;br /&gt;Java API for XML-Based RPC (JAX-RPC)&lt;br /&gt;Java API for XML Registries (JAXR)&lt;br /&gt;Java API for XML Processing (JAXP)&lt;br /&gt;Java Architecture for XML Binding (JAXB)&lt;br /&gt;SOAP with Attachments API for Java (SAAJ)&lt;br /&gt;XML and Web Services Security&lt;br /&gt;&lt;br /&gt;Web Services Overview:&lt;br /&gt;&lt;br /&gt;- Extensible Markup Language (XML)&lt;br /&gt;- Web Services/XML APIs&lt;br /&gt;- Java Platform Tools&lt;br /&gt;&lt;br /&gt;The Java 2 Platform, Enterprise Edition platform provides the APIs and tools you need to quickly design, develop, test, and deploy Web services and clients that fully interoperate with other Web services and clients running on any platform. This full interoperability is possible because application data is translated "behind-the-scenes" to a standardized XML-based data stream.&lt;br /&gt;&lt;br /&gt;A brief overview of XML, APIs, and tools is presented here. See also The J2EE Tutorial for detailed information with examples.&lt;br /&gt;&lt;br /&gt;Extensible Markup Language (XML)&lt;br /&gt;Extensible Markup Language (XML) is a cross-platform, extensible, and text-based standard for representing data. When XML data is exchanged between parties, the parties are free to create their own tags to describe the data, set up schemas to specify which tags can be used in a particular kind of XML document, and use XML style sheets to manage the display and handling of the data.&lt;br /&gt;&lt;br /&gt;Web Services/XML APIs&lt;br /&gt;It is easy to write Web services and clients with the J2EE XML APIs. All you do is pass parameter data to the method calls and process the data returned, or for document-oriented web services, send documents containing the service data back and forth. No low-level programming is needed. The following list describes the Web services/XML APIs.&lt;br /&gt;&lt;br /&gt;The Java API for XML Processing (JAXP) supports the processing of XML documents using Document Object Model (DOM), Simple API for XML Parsing (SAX), and XML Style sheet Language Transformation (XSLT). The JAXP API enables applications to parse and transform XML documents independently of a particular XML processing implementation.&lt;br /&gt;&lt;br /&gt;The Java API for XML Registries (JAXR) lets you access business and general-purpose registries over the Web. JAXR supports the ebXML Registry/Repository standards and the UDDI specifications.&lt;br /&gt;&lt;br /&gt;The Java API for XML-based RPC (JAX-RPC) uses the SOAP standard and HTTP so client programs can make XML-based remote procedure calls (RPCs) over the Internet. JAX-RPC also supports WSDL so you can import and export WSDL documents. With JAX-RPC and a WSDL, you can easily interoperate with clients and services running on Java-based or non-Java-based platforms such as .NET.&lt;br /&gt;&lt;br /&gt;The SOAP with Attachments API for Java (SAAJ) enables you to produce and consume messages conforming to the SOAP 1.1 specification and SOAP with Attachments note.&lt;br /&gt;&lt;br /&gt;Java Platform Tools&lt;br /&gt;Web Services/XML works with an array of tools including Integrated Development Environments (IDEs), performance and testing tools, and performance monitoring tools.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112696556480452068?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112696556480452068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112696556480452068&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696556480452068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696556480452068'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-technology-and-web-services.html' title='Java Technology and Web Services'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112696577591975626</id><published>2005-09-17T07:01:00.000-07:00</published><updated>2005-09-25T22:13:16.150-07:00</updated><title type='text'>Web Services Essentials</title><content type='html'>&lt;span style="font-family:arial;"&gt;Introduction to Web Services&lt;br /&gt;&lt;br /&gt;Web services, in the general meaning of the term, are services offered on the Web. In a typical Web services scenario, a business application uses the SOAP protocol over HTTP to send a request to a service at an URL. The service receives the request, processes it, and returns a response. An often-cited example of a Web service is that of a stock quote service, in which the request asks for the current price of a specified stock and the response returns the stock price. This is one of the simplest forms of a Web service: The request is fulfilled almost immediately; the request and response are parts of the same method call.&lt;br /&gt;&lt;br /&gt;Another example could be a service that maps out an efficient route for the delivery of goods. In this case, a business sends a request with the delivery destinations, which the service then processes to determine the most cost-effective delivery route. The time it takes to return the response depends on the complexity of the routing; therefore, the response will probably be sent as an operation separate from the request.&lt;br /&gt;&lt;br /&gt;Web services and their consumers are typically businesses, making Web services predominantly business-to-business (B-to-B) transactions. An enterprise can be the Web service provider and also the consumer of other Web services. For example, a wholesale distributor of spices is in the consumer role when it uses a Web service to check on the availability of vanilla beans and in the provider role when it supplies prospective customers with prices for vanilla beans.&lt;br /&gt;&lt;br /&gt;The Role of XML and the Java Platform&lt;br /&gt;&lt;br /&gt;Web services depend on the ability of parties to communicate with each other even if they are using different information systems. XML (eXtensible Markup Language), which makes data portable, is a key technology in addressing this need. Enterprises have discovered the benefits of using XML for the integration of data -- both internally for sharing legacy data among departments and externally for sharing data with other enterprises. As a result, XML is increasingly being used for enterprise application integration (EAI) in tightly coupled and loosely coupled systems. Thanks to its ability to integrate data, XML has become the underpinning for Web-related computing.&lt;br /&gt;&lt;br /&gt;Overview of the Java APIs for XML (JAX APIs)&lt;br /&gt;&lt;br /&gt;You can use the JAX APIs to develop Web applications entirely in the Java programming language. The APIs fall into two broad categories: those that deal directly with processing XML documents and those that deal with procedures.&lt;br /&gt;&lt;br /&gt;Document-oriented&lt;br /&gt;&lt;br /&gt;- Java API for XML Processing (JAXP) -- Processes XML documents with parsers.&lt;br /&gt;- Java Architecture for XML Binding (JAXB) -- Processes XML documents with schema-derived JavaBeans component classes.&lt;br /&gt;&lt;br /&gt;Procedure-oriented&lt;br /&gt;&lt;br /&gt;- Java API for XML-based RPC (JAX-RPC) -- Sends SOAP method calls to remote parties over the Internet and receives the results.&lt;br /&gt;- Java API for XML Messaging (SAAJ) -- Sends SOAP messages over the Internet in a standard way.&lt;br /&gt;- Java API for XML Registries (JAXR) -- Provides a standard way to access business registries and share information.&lt;br /&gt;&lt;br /&gt;Perhaps the most important feature of JAX APIs is that they all support industry standards, ensuring interoperability.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112696577591975626?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112696577591975626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112696577591975626&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696577591975626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696577591975626'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/web-services-essentials.html' title='Web Services Essentials'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112696509994603663</id><published>2005-09-17T06:46:00.000-07:00</published><updated>2005-09-22T01:22:11.506-07:00</updated><title type='text'>Applet Security</title><content type='html'>&lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;What are applets prevented from doing?&lt;/strong&gt;&lt;br /&gt;In general, applets loaded over the net are prevented from reading and writing files on the client file system, and from making network connections except to the originating host.&lt;br /&gt;&lt;br /&gt;In addition, applets loaded over the net are prevented from starting other programs on the client. Applets loaded over the net are also not allowed to load libraries, or to define native method calls. If an applet could define native method calls, that would give the applet direct access to the underlying computer.&lt;br /&gt;&lt;br /&gt;There are other specific capabilities denied to applets loaded over the net, but most of the applet security policy is described by those two paragraphs above. Read on for the gory details.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can applets read or write files?&lt;/strong&gt;&lt;br /&gt;In Java-enabled browsers, untrusted applets cannot read or write files at all. By default, downloaded applets are considered untrusted. There are two ways for an applet to be considered trusted:&lt;br /&gt;&lt;br /&gt;The applet is installed on the local hard disk, in a directory on the CLASSPATH used by the program that you are using to run the applet. Usually, this is a Java-enabled browser, but it could be the appletviewer, or other Java programs that know how to load applets.&lt;br /&gt;&lt;br /&gt;The applet is signed by an identity marked as trusted in your identity database. For more information on signed applets, refer to an example of using signed applets, and to a short description on using javakey.&lt;br /&gt;&lt;br /&gt;Sun's appletviewer allows applets to read files that reside in directories on the access control lists.&lt;br /&gt;&lt;br /&gt;If the file is not on the client's access control list, then applets cannot access the file in any way. Specifically, applets cannot&lt;br /&gt;&lt;br /&gt;check for the existence of the file&lt;br /&gt;read the file&lt;br /&gt;write the file&lt;br /&gt;rename the file&lt;br /&gt;create a directory on the client file system&lt;br /&gt;list the files in this file (as if it were a directory)&lt;br /&gt;check the file's type&lt;br /&gt;check the timestamp when the file was last modified&lt;br /&gt;check the file's size&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do I let an applet read a file?&lt;/strong&gt;&lt;br /&gt;Applets loaded into a Java-enabled browser can't read files.&lt;br /&gt;&lt;br /&gt;Sun's appletviewer allows applets to read files that are named on the access control list for reading. The access control list for reading is null by default, in the JDK. You can allow applets to read directories or files by naming them in the acl.read property in your ~/.hotjava/properties file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note: The "~" (tilde) symbol is used on UNIX systems to refer to your home directory. If you install a web browser on your F:\ drive on your PC, and create a top-level directory named .hotjava, then your properties file is found in F:\.hotjava\properties.&lt;br /&gt;&lt;br /&gt;For example, to allow any files in the directory home/me to be read by applets loaded into the appletviewer, add this line to your ~/.hotjava/properties file.&lt;br /&gt;&lt;br /&gt;acl.read=/home/me&lt;br /&gt;&lt;br /&gt;You can specify one file to be read: acl.read=/home/me/somedir/somefile&lt;br /&gt;&lt;br /&gt;Use ":" to separate entries: acl.read=/home/foo:/home/me/somedir/somefile&lt;br /&gt;&lt;br /&gt;Allowing an applet to read a directory means that it can read all the files in that directory, including any files in any subdirectories that might be hanging off that directory.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do I let an applet write a file?&lt;/strong&gt;&lt;br /&gt;Applets loaded into a Java-enabled browser can't write files.&lt;br /&gt;&lt;br /&gt;Sun's appletviewer allows applets to write files that are named on the access control list for writing. The access control list for writing is empty by default.&lt;br /&gt;&lt;br /&gt;You can allow applets to write to your /tmp directory by setting the acl.write property in your ~/.hotjava/properties file: acl.write=/tmp&lt;br /&gt;&lt;br /&gt;You can allow applets to write to a particular file by naming it explicitly:&lt;br /&gt;acl.write=/home/me/somedir/somefile&lt;br /&gt;&lt;br /&gt;Use : to separate entries: acl.write=/tmp:/home/me/somedir/somefile&lt;br /&gt;&lt;br /&gt;Bear in mind that if you open up your file system for writing by applets, there is no way to limit the amount of disk space an applet might use.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What system properties can be read by applets, and how?&lt;/strong&gt;&lt;br /&gt;In both Java-enabled browsers and the appletviewer, applets can read these system properties by invoking System.getProperty(String key):&lt;br /&gt;key meaning&lt;br /&gt;&lt;br /&gt;java.version Java version number&lt;br /&gt;java.vendor Java vendor-specific string&lt;br /&gt;java.vendor.url Java vendor URL&lt;br /&gt;java.class.version Java class version number&lt;br /&gt;os.name Operating system name&lt;br /&gt;os.arch Operating system architecture&lt;br /&gt;os.version Operating system version&lt;br /&gt;file.separator File separator (eg, "/")&lt;br /&gt;path.separator Path separator (eg, ":")&lt;br /&gt;line.separator Line separator&lt;br /&gt;&lt;br /&gt;Applets are prevented from reading these system properties:&lt;br /&gt;key meaning&lt;br /&gt;&lt;br /&gt;java.home Java installation directory&lt;br /&gt;java.class.path Java classpath&lt;br /&gt;user.name User account name&lt;br /&gt;user.home User home directory&lt;br /&gt;user.dir User's current working directory&lt;br /&gt;&lt;br /&gt;To read a system property from within an applet, simply invoke System.getProperty(key) on the property you are interested in.&lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;String s = System.getProperty("os.name");&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How do I hide system properties that applets are allowed to read by default?&lt;/strong&gt;&lt;br /&gt;There's no way to hide the above ten system properties from applets loaded into a Java-enabled browser. The reason is that the browsers don't consult any external files as part their Java configuration, as a security precaution, including the ~/.hotjava/properties file.&lt;br /&gt;&lt;br /&gt;From the appletviewer, you can prevent applets from finding out anything about your system by redefining the property in your ~/.hotjava/properties file. For example, to hide the name of the operating system that you are using, add this line to your ~/.hotjava/properties file: os.name=null&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can I allow applets to read system properties that they aren't allowed to read by default?&lt;/strong&gt;&lt;br /&gt;There's no way to allow an applet loaded into a Java-enabled browser to read system properties that they aren't allowed to read by default.&lt;br /&gt;&lt;br /&gt;To allow applets loaded into the appletviewer to read the property named by key, add the property key.applet=true to your ~/.hotjava/property file. For example, to allow applets to record your user name, add this line to your ~/.hotjava/properties file:&lt;br /&gt;user.name.applet=true&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can an applet open a network connection to a computer on the internet?&lt;/strong&gt;&lt;br /&gt;Applets are not allowed to open network connections to any computer, except for the host that provided the .class files. This is either the host where the html page came from, or the host specified in the codebase parameter in the applet tag, with codebase taking precendence.&lt;br /&gt;&lt;br /&gt;For example, if you try to do this from an applet that did not originate from the machine foo.com, it will fail with a security exception:&lt;br /&gt;Socket s = new Socket("foo.com", 25, true);&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can an applet open a network connection to its originating host?&lt;/strong&gt;&lt;br /&gt;Be sure to name the originating host exactly as it was specified when the applet was loaded into the browser.&lt;br /&gt;&lt;br /&gt;That is, if you load an HTML page using the URL&lt;br /&gt;http://foo.state.edu/~me/appletPage.html&lt;br /&gt;&lt;br /&gt;then your applet will be able to connect to its host only by using the name foo.state.edu. Using the IP address for foo.state.edu won't work, and using a "shorthand" form of the host name, like foo.state instead of foo.state.edu, won't work.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can an applet maintain persistent state?&lt;/strong&gt;&lt;br /&gt;There is no explicit support in the JDK applet API for persistent state on the client side. However, an applet can maintain its own persistent state on the server side. That is, it can create files on the server side and read files from the server side.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can an applet start another program on the client?&lt;/strong&gt;&lt;br /&gt;No, applets loaded over the net are not allowed to start programs on the client. That is, an applet that you visit can't start some rogue process on your PC. In UNIX terminology, applets are not allowed to exec or fork processes. In particular, this means that applets can't invoke some program to list the contents of your file system, and it means that applets can't invoke System.exit() in an attempt to kill your web browser. Applets are also not allowed to manipulate threads outside the applet's own thread group.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What features of the Java language help people build secure applets?&lt;br /&gt;&lt;/strong&gt;Java programs do not use pointers explicitly. Objects are accessed by getting a handle to the object. Effectively, this is like getting a pointer to an object, but Java does not allow the equivalent of pointer arithmetic on object handles. Object handles cannot be modified in any way by the Java applet or application.&lt;br /&gt;&lt;br /&gt;C and C++ programmers are used to manipulating pointers to implement strings and to implement arrays. Java has high-level support for both strings and arrays, so programmers don't need to resort to pointer arithmetic in order to use those data structures.&lt;br /&gt;&lt;br /&gt;Arrays are bounds-checked at runtime. Using a negative index causes a runtime exception, and using an index that is larger than the size of the array causes a runtime exception. Once an array object is created, its length never changes.&lt;br /&gt;&lt;br /&gt;Strings in Java are immutable. A string is zero or more characters enclosed in double quotes, and it's an instance of the String class. Using immutable strings can help prevent common runtime errors that could be exploited by hostile applets.&lt;br /&gt;&lt;br /&gt;The Java compiler checks that all type casts are legal. Java is a strongly typed language, unlike C or C++, and objects cannot be cast to a subclass without an explicit runtime check.&lt;br /&gt;&lt;br /&gt;The final modifier can be used when initializing a variable, to prevent runtime modification of that variable. The compiler catches attempts to modify final variables.&lt;br /&gt;&lt;br /&gt;Before a method is invoked on an object, the compiler checks that the object is the correct type for that method. For example,&lt;br /&gt;&lt;br /&gt;invoking t.currentThread() when t is not a Thread object causes a compile time error.&lt;br /&gt;&lt;br /&gt;Java provides four access modifiers for methods and variables defined within classes and makes sure that these access barriers are not violated.&lt;br /&gt;&lt;br /&gt;public: a public method is accessible anywhere the class name is accessible&lt;br /&gt;protected: a protected method is accessible by a child of a class as long as it is trying to access fields in a similarly typed class.&lt;br /&gt;&lt;br /&gt;For example,&lt;br /&gt;class Parent { protected int x; }&lt;br /&gt;class Child extends Parent { ... }&lt;br /&gt;&lt;br /&gt;The class Child can access the field "x" only on objects that are of type Child (or a subset of Child.)&lt;br /&gt;&lt;br /&gt;private: a private method is accessible only within its defining class&lt;br /&gt;&lt;br /&gt;default: if no modifier is specified, then by default, a method is accessible only within its defining package&lt;br /&gt;&lt;br /&gt;For example, programmers can choose to implement sensitive functions as private methods. The compiler and the runtime checks ensure that no objects outside the class can invoke the private methods.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is the difference between applets loaded over the net and applets loaded via the file system?&lt;/strong&gt;&lt;br /&gt;There are two different ways that applets are loaded by a Java system. The way an applet enters the system affects what it is allowed to do.&lt;br /&gt;&lt;br /&gt;If an applet is loaded over the net, then it is loaded by the applet class loader, and is subject to the restrictions enforced by the applet security manager.&lt;br /&gt;&lt;br /&gt;If an applet resides on the client's local disk, and in a directory that is on the client's CLASSPATH, then it is loaded by the file system loader. The most important differences are&lt;br /&gt;&lt;br /&gt;applets loaded via the file system are allowed to read and write files&lt;br /&gt;applets loaded via the file system are allowed to load libraries on the client&lt;br /&gt;applets loaded via the file system are allowed to exec processes&lt;br /&gt;applets loaded via the file system are allowed to exit the virtual machine&lt;br /&gt;applets loaded via the file system are not passed through the byte code verifier&lt;br /&gt;Java-enabled browsers use the applet class loader to load applets specified with file: URLs. So, the restrictions and protections that accrue from the class loader and its associated security manager are now in effect for applets loaded via file: URLs.&lt;br /&gt;&lt;br /&gt;This means that if you specify the URL like so:&lt;br /&gt;Location: file:/home/me/public_html/something.html&lt;br /&gt;&lt;br /&gt;and the file something.html contains an applet, the browser loads it using its applet class loader.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What's the applet class loader, and what does it buy me?&lt;/strong&gt;&lt;br /&gt;Applets loaded over the net are loaded by the applet class loader. For example, the appletviewer's applet class loader is implemented by the class sun.applet.AppletClassLoader.&lt;br /&gt;&lt;br /&gt;The class loader enforces the Java name space hierarchy. The class loader guarantees that a unique namespace exists for classes that come from the local file system, and that a unique namespace exists for each network source. When a browser loads an applet over the net, that applet's classes are placed in a private namespace associated with the applet's origin. Thus, applets loaded from different network sources are partitioned from each other.&lt;br /&gt;&lt;br /&gt;Also, classes loaded by the class loader are passed through the verifier. The verifier checks that the class file conforms to the Java language specification - it doesn't assume that the class file was produced by a "friendly" or "trusted" compiler. On the contrary, it checks the class file for purposeful violations of the language type rules and name space restrictions. The verifier ensures that&lt;br /&gt;&lt;br /&gt;There are no stack overflows or underflows.&lt;br /&gt;All register accesses and stores are valid.&lt;br /&gt;The parameters to all bytecode instructions are correct.&lt;br /&gt;There is no illegal data conversion.&lt;br /&gt;The verifier accomplishes that by doing a data-flow analysis of the bytecode instruction stream, along with checking the class file format, object signatures, and special analysis of finally clauses that are used for Java exception handling.&lt;br /&gt;&lt;br /&gt;Details on the verifier's design and implementation were presented in a paper by Frank Yellin at the December 1995 WWW conference in Boston.&lt;br /&gt;&lt;br /&gt;A web browser uses only one class loader, which is established at start-up. Thereafter, the system class loader cannot be extended, overloaded, overridden or replaced. Applets cannot create or reference their own class loader.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What's the applet security manager, and what does it buy me?&lt;/strong&gt;&lt;br /&gt;The applet security manager is the Java mechanism for enforcing the applet restrictions described above. The appletviewer's applet security manager is implemented by sun.applet.AppletSecurity.&lt;br /&gt;&lt;br /&gt;A browser may only have one security manager. The security manager is established at startup, and it cannot thereafter be replaced, overloaded, overridden, or extended. Applets cannot create or reference their own security manager.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Is there a summary of applet capabilities?&lt;/strong&gt;&lt;br /&gt;The following table is not an exhaustive list of applet capabilities. It's meant to answer the questions we hear most often about what applets can and cannot do.&lt;br /&gt;&lt;br /&gt;Key:&lt;br /&gt;&lt;br /&gt;NN: Netscape Navigator 4.x, loading unsigned applets over the Net&lt;br /&gt;NL: Netscape Navigator 4.x, loading unsigned applets from the Local file system&lt;br /&gt;AN: Appletviewer, JDK 1.x, loading applets over the Net&lt;br /&gt;AL: Appletviewer, JDK 1.x, loading applets from the Local file system&lt;br /&gt;JS: Java Standalone applications&lt;br /&gt;&lt;br /&gt;Stricter ------------------------&gt; Less strict&lt;br /&gt;&lt;br /&gt;NN NL AN AL JS&lt;br /&gt;&lt;br /&gt;read file in /home/me, no no no yes yes&lt;br /&gt;acl.read=null&lt;br /&gt;&lt;br /&gt;read file in /home/me, no no yes yes yes&lt;br /&gt;acl.read=/home/me&lt;br /&gt;&lt;br /&gt;write file in /tmp, no no no yes yes&lt;br /&gt;acl.write=null&lt;br /&gt;&lt;br /&gt;write file in /tmp, no no yes yes yes&lt;br /&gt;acl.write=/tmp&lt;br /&gt;&lt;br /&gt;get file info, no no no yes yes&lt;br /&gt;acl.read=null&lt;br /&gt;acl.write=null&lt;br /&gt;&lt;br /&gt;get file info, no no yes yes yes&lt;br /&gt;acl.read=/home/me&lt;br /&gt;acl.write=/tmp&lt;br /&gt;&lt;br /&gt;delete file, no no no no yes&lt;br /&gt;using File.delete()&lt;br /&gt;&lt;br /&gt;delete file, no no no yes yes&lt;br /&gt;using exec /usr/bin/rm&lt;br /&gt;&lt;br /&gt;read the user.name no yes no yes yes&lt;br /&gt;property&lt;br /&gt;&lt;br /&gt;connect to port no no no yes yes&lt;br /&gt;on client&lt;br /&gt;&lt;br /&gt;connect to port no no no yes yes&lt;br /&gt;on 3rd host&lt;br /&gt;&lt;br /&gt;load library no yes no yes yes&lt;br /&gt;&lt;br /&gt;exit(-1) no no no yes yes&lt;br /&gt;&lt;br /&gt;create a popup no yes no yes yes&lt;br /&gt;window without&lt;br /&gt;a warning&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;If other languages are compiled to Java bytecodes, how does that affect the applet security model?&lt;/strong&gt;&lt;br /&gt;The verifier is independent of Sun's reference implementation of the Java compiler and the high-level specification of the Java language. It verifies bytecodes generated by other Java compilers. It also verifies bytecodes generated by compiling other languages into the bytecode format. Bytecodes imported over the net that pass the verifier can be trusted to run on the Java virtual machine. In order to pass the verifier, bytecodes have to conform to the strict typing, the object signatures, the class file format, and the predictability of the runtime stack that are all defined by the Java language implementation.&lt;/span&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112696509994603663?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112696509994603663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112696509994603663&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696509994603663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696509994603663'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/applet-security.html' title='Applet Security'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112696436391459043</id><published>2005-09-17T06:37:00.000-07:00</published><updated>2005-09-18T20:50:02.083-07:00</updated><title type='text'>Security Tradeoffs: Java vs. ActiveX</title><content type='html'>&lt;strong&gt;What are Java and ActiveX?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Java and ActiveX are two systems that let people attach computer programs to Web pages. People like these systems because they allow Web pages to be much more dynamic and interactive than they could be otherwise.&lt;br /&gt;&lt;br /&gt;However, Java and ActiveX do introduce some security risk, because they can cause potentially hostile programs to be automatically downloaded and run on your computer, just because you visited some Web page. The downloaded program could try to access or damage the data on your machine, for example to insert a virus. Both Java and ActiveX take measures to protect your from this risk.&lt;br /&gt;&lt;br /&gt;There has been a lot of public debate over which system offers better security. This page gives our opinion on this debate. Java and ActiveX take fundamentally different approaches to security. We will concentrate on comparing the approaches, rather than critiquing the details of the two systems. After all, details can be fixed.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Who are the players?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Java was developed by JavaSoft, a division of Sun Microsystems. Java is supported by both of the major browsers, Netscape Navigator and Microsoft Internet Explorer.&lt;br /&gt;&lt;br /&gt;ActiveX was developed by Microsoft. It is supported in Microsoft's Internet Explorer, and an ActiveX plug-in is available for Netscape Navigator.&lt;br /&gt;&lt;br /&gt;The most intense public debate about security has been between JavaSoft and Microsoft. Each company has accused the other of being careless about security, and some misleading charges have been made.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How does security work in ActiveX?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;ActiveX security relies entirely on human judgement. ActiveX programs come with digital signatures from the author of the program and anybody else who chooses to endorse the program.&lt;br /&gt;&lt;br /&gt;Think of a digital signature as being like a person's signature on paper. Your browser can look at a digital signature and see whether it is genuine, so you can know for sure who signed a program. (That's the theory, at least. Things don't always work out so neatly in practice.)&lt;br /&gt;&lt;br /&gt;Once your browser has verified the signatures, it tells you who signed the program and asks you whether or not to run it. You have two choices: either accept the program and let it do whatever it wants on your machine, or reject it completely.&lt;br /&gt;&lt;br /&gt;ActiveX security relies on you to make correct decisions about which programs to accept. If you accept a malicious program, you are in big trouble.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How does security work in Java?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Java security relies entirely on software technology. Java accepts all downloaded programs and runs them within a security "sandbox". Think of the sandbox as a security fence that surrounds the program and keeps it away from your private data. As long as there are no holes in the fence, you are safe.&lt;br /&gt;&lt;br /&gt;Java security relies on the software implementing the sandbox to work correctly.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can ActiveX security break down?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The main danger in ActiveX is that you will make the wrong decision about whether to accept a program. One way this can happen is that some person you trust turns out not to deserve that trust.&lt;br /&gt;&lt;br /&gt;The most dangerous situation, though, is when the program is signed by someone you don't know anything about. You'd really like to see what this program does, but if you reject it you won't be able to see anything. So you rationalize: the odds that this particular program is hostile are very small, so why not go ahead and accept it? After all, you accepted three programs yesterday and nothing went wrong. It's just human nature to accept the program.&lt;br /&gt;&lt;br /&gt;Even if the risk of accepting one program is low, the risk adds up when you repeatedly accept programs. And when you do get the one bad program, there is no limit on how much damage it can do.&lt;br /&gt;&lt;br /&gt;The only way to avoid this scenario is to refuse all programs, no matter how fun or interesting they sound, except programs that come from a few people you know well. Who has the self-discipline to do that?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can Java security break down?&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;The main danger in Java comes from the complexity of the software that implements the sandbox. Common sense says that complicated technology is more likely to break down than simple technology. Java is pretty complicated, and several breakdowns have happened in the past.&lt;br /&gt;&lt;br /&gt;If you're the average person, you don't have the time or the desire to examine Java and look for implementation errors. So you have to hope the implementers did everything right. They're smart and experienced and motivated, but that doesn't make them infallible.&lt;br /&gt;&lt;br /&gt;When Java security does break down, the potential consequences are just as bad as those of an ActiveX problem: a hostile program can come to your machine and access your data at will.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What about "signed applets" in Java?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;One problem with the original version of Java is that the "sandbox" can be too restrictive. For example, Java programs are not allowed to access files, so there's no way to write a text editor. (What good is editing if you can't save your work?)&lt;br /&gt;Java-enabled products are now starting to use digital signatures to work around this problem. The idea is like ActiveX: programs are digitally signed and you can decide, based on the signature, to give a program more power than it would otherwise have. This lets you run a text editor program if you decide that you trust its author.&lt;br /&gt;&lt;br /&gt;The downside of this scheme is that it introduces some of the ActiveX problems. If you make the wrong decision about who to trust, you could be very sorry. There's no known way to get around this dilemma. Some kinds of programs must be given power in order to be useful, and there's no ironclad guarantee that those programs will be well-behaved.&lt;br /&gt;&lt;br /&gt;Still, Java with signed applets does offer some advantages over ActiveX. You can put only partial trust in a program, while ActiveX requires either full trust or no trust at all. And a Java-enabled browser could keep a record of which dangerous operations are carried out by each trusted program, so it would be easier to reconstruct what happened if anything went wrong. (Current browsers don't do this record-keeping, but we wish they would.) Finally, Java offers better protection against accidental damage caused by buggy programs.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What about plug-ins?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Plug-ins are a method for adding code to your browser. Plug-ins have the same security model as ActiveX: when you download a plug-in, you are trusting it to be harmless. All of the warnings about ActiveX programs apply to plug-ins too.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Can I be hurt by a "good" plug-in or ActiveX program?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, yes. This depends entirely on what the plug-in or program does. Many plug-ins such as Macromedia's Shockwave or Sun's Safe-Tcl are actually completely general programming systems, just like Java. By accepting a plug-in like this, you're trusting that the plug-in program has no security-relevant bugs. As we have seen with Java, systems that are meant to be secure often have bugs that lead to security problems.&lt;br /&gt;With ActiveX, this problem is made worse if you click the box which accepts all programs signed by the same person (for example, if you accept anything signed by Microsoft). While one Microsoft program may be secure, another one may have a security-relevant bug.&lt;br /&gt;&lt;br /&gt;This problem even applies to code written by your own company for internal use. Once the plug-in or program is installed in your browser, an external attacker (who knew about the program) could write a Web page which used your internal program bug passed it funny data which corrupted the program and took over your machine.&lt;br /&gt;&lt;br /&gt;If you're feeling paranoid, the only plug-ins you should allow are those with less than general purpose functionality. A plug-in which handles a new image, video, or audio format is less likely to be exploitable than a plug-in for a completely general animation system.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;This sounds pretty scary. How worried should I be?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;The good news is that there have been few incidents of people being damaged by hostile Java or ActiveX programs. The reason is simply that the people with the skills to create malicious programs have chosen not to do so.&lt;br /&gt;&lt;br /&gt;For most people, continuing to use Java and ActiveX is the right choice. If you are informed about the risks, you can make a rational decision to accept some danger in exchange for the benefits of using Java and ActiveX.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can I lower my risk?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;There are several things you can do.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Think very carefully before accepting a digitally signed program. How competent and trustworthy is the signer?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Use up-to-date browser versions, and install the security patches offered by your browser vendor.&lt;br /&gt;&lt;br /&gt;Never surf the Web on a computer that contains highly sensitive information like medical records.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112696436391459043?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112696436391459043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112696436391459043&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696436391459043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696436391459043'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/security-tradeoffs-java-vs-activex.html' title='Security Tradeoffs: Java vs. ActiveX'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112696414369494357</id><published>2005-09-17T06:33:00.000-07:00</published><updated>2005-09-18T20:43:16.766-07:00</updated><title type='text'>FAQ on Java Security Part 1</title><content type='html'>Is Java secure?&lt;br /&gt;&lt;br /&gt;Nothing in life is completely secure; Java is no exception. Several specific security problems have been discovered and fixed since Java was first released. If you're using an up-to-date Web browser, you are usually safe against the known attacks. However, nobody is safe against attacks that haven't been discovered yet.&lt;br /&gt;If somebody says Java is safe because ``hackers aren't smart enough to exploit the problems,'' don't believe them. We're disappointed that some people who should know better are still spouting this nonsense. We've discovered several security problems, and we're pretty sure we're not the smartest people in the world. If one group of hackers creates a Java-based attack and shares it with their friends, we're all in trouble.&lt;br /&gt;&lt;br /&gt;Other Web ``scripting'' tools such as JavaScript, Visual Basic Script, or ActiveX face the same sorts of problems as Java. ``Plug-in'' mechanisms provide no security protection. If you install a plug-in, you're trusting that plug-in to be harmless.&lt;br /&gt;&lt;br /&gt;What are the risks?&lt;br /&gt;&lt;br /&gt;There are two classes of security problems: nuisances and security breaches. A nuisance attack merely prevents you from getting your work done - for example it may cause your computer to crash. Security breaches are more serious: your files could be deleted, your private data could be read, or a virus could infect your machine.&lt;br /&gt;If you are the victim of a security breach, any data stored on your machine may be read or corrupted by a bad guy. If you've got important company secrets on your computer, maybe you should surf the net on another machine.&lt;br /&gt;&lt;br /&gt;In the not-too-distant future, your computer may be able to digitally sign documents that are legally binding, just like your paper signature. Your computer may also be able to spend your money. In a world like that, security becomes even more important than it is right now.&lt;br /&gt;&lt;br /&gt;How common are security breaches?&lt;br /&gt;&lt;br /&gt;So far, there have been no publicly reported, confirmed cases of security breaches involving Java, though there have been some suspicious events that might possibly have involved Java security problems. Of course, the lack of reported cases is no guarantee that there haven't been breaches that either weren't discovered or weren't reported. But it does indicate that breaches are rare.&lt;br /&gt;&lt;br /&gt;Who is at risk?&lt;br /&gt;&lt;br /&gt;You're at risk if you're running a Java-enabled browser and you visit a Web page written by a person you don't know or don't trust. Since the two most common browsers, Netscape Navigator and Microsoft Internet Explorer, are Java-enabled, most people surfing the Web are at risk.&lt;br /&gt;&lt;br /&gt;How can I protect myself?&lt;br /&gt;&lt;br /&gt;If you maintain sensitive data on your computer that you think an unscrupulous adversary might want, you should disable Java and JavaScript, as well as not installing plug-ins, except from well-known vendors.&lt;br /&gt;&lt;br /&gt;If you don't disable Java or JavaScript, think twice before visiting a Web site belonging to a person you don't know or don't trust. Of course, some people will be perfectly happy just living with the risk.&lt;br /&gt;&lt;br /&gt;You can reduce the damage caused by a potential security breach by taking common-sense precautions like backing up your data frequently and keeping sensitive data off your Web-surfing machine.&lt;br /&gt;&lt;br /&gt;What about products that claim to detect malicious applets?&lt;br /&gt;&lt;br /&gt;We are skeptical about these products. They probably can't hurt, but don't let yourself get a false sense of security from using them.&lt;br /&gt;&lt;br /&gt;What about products that claim to block Java applets at a firewall?&lt;br /&gt;&lt;br /&gt;Recent research by David Martin, S. Rajagopalan, and Avi Rubin suggests that it is extremely difficult, if not impossible, to do this, so we suspect that these products can be bypassed by sophisticated attackers.&lt;br /&gt;&lt;br /&gt;If you want to block Java, the best way to do it is by setting your browser preferences to disable Java.&lt;br /&gt;&lt;br /&gt;How can I restrict which sites my browser will accept applets from?&lt;br /&gt;&lt;br /&gt;We are about to release a prototype tool that lets you do this.&lt;br /&gt;&lt;br /&gt;Won't digital signatures solve all of the problems?&lt;br /&gt;&lt;br /&gt;No, they'll only help a little. Digital signatures let you know who wrote an applet, but they don't help you decide whether you can trust the author.&lt;br /&gt;&lt;br /&gt;Is this problem ever going to go away?&lt;br /&gt;&lt;br /&gt;No. Security will always be an issue with any network software. As long as vendors are racing their products out the door and adding new functionality with each and every release, you can expect security bugs will always exist. Writing crash-proof software is hard. Writing secure software is even harder.&lt;br /&gt;&lt;br /&gt;Which is more secure: Netscape Navigator or Microsoft Internet Explorer?&lt;br /&gt;&lt;br /&gt;In our judgement, the latest versions of the two browsers offer roughly comparable levels of security.&lt;br /&gt;&lt;br /&gt;Which version of my browser should I use?&lt;br /&gt;&lt;br /&gt;Generally, the latest version is the safest. Be sure to regularly check your browser vendor's Web pages for announcements of new versions. Look carefully - the announcements are not always prominent.&lt;br /&gt;&lt;br /&gt;What about ``hostile applets?''&lt;br /&gt;&lt;br /&gt;This is a general term for Java applets (programs) that exploit security bugs. There are some pages on the Web that demonstrate, with appropriate warning messages, some hostile applets. The applets we've seen are nuisance attacks rather than damaging attacks.&lt;br /&gt;&lt;br /&gt;I run a Web server. Am I at risk?&lt;br /&gt;&lt;br /&gt;Not directly. But watch out for some newer servers that support "servlets". Servlets are fine if they are all written by the people running the server site; using servlets in this way is probably better than using CGI scripts. Going beyond this to let clients upload Java servlets into your server is very risky.&lt;br /&gt;Of course, you should be careful about which Java applets appear on your server. Unless you wrote the applet yourself, you don't necessarily know what it's doing. If you copy somebody else's applet, it could possibly be a trojan horse - doing something useful as well as being malicious.&lt;br /&gt;&lt;br /&gt;What about JavaScript?&lt;br /&gt;&lt;br /&gt;Java and JavaScript, despite the similarity of their names, are not related. (Isn't marketing wonderful?) JavaScript has its own security problems, so you may also want to disable JavaScript.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112696414369494357?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112696414369494357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112696414369494357&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696414369494357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112696414369494357'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/faq-on-java-security-part-1.html' title='FAQ on Java Security Part 1'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112684276146942217</id><published>2005-09-15T20:52:00.000-07:00</published><updated>2005-09-15T21:05:41.416-07:00</updated><title type='text'>Introduction to new Tiger version of Java and 6 major syntax changes</title><content type='html'>&lt;p class="MsoNormal" align="left"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;The new Java 1.5 Tiger edition J2SE1.5 has just gone public beta at the end of January and is &lt;a href="http://java.sun.com/j2se/1.5.0/download.jsp" target="_blank"&gt;&lt;span style="color:black;"&gt;&lt;span style="color:windowtext;"&gt;available for download&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; for Linux, Solaris32 and 64bit plus Windows in 32bit and 64bit AMDchip versions. Copious documentation of all the new features for the new version of Java is available at &lt;a href="http://java.sun.com/j2se/1.5/" target="_blank"&gt;&lt;span style="color:black;"&gt;&lt;span style="color:windowtext;"&gt;Sun's Core Java 1.5 site.&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; This is the first upgrade to Java that makes several changes and additions to the Java syntax since the 1.1 edition back in 1997 added nested classes. So the Tiger edition of Java with its 6 principle upgrades marks a transition for Java - changes not just to the objects but also the basic syntax of the language.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="left"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="Section1" align="left"&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="FONT-WEIGHT: bold;font-family:Arial;color:windowtext;"  &gt;Here are the 6 major changes to Java syntax and some of their implications.&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="Section1" align="left"&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;1)Generics&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt; allows the type of contents of arrays and other collections to be specified as in the following: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;void cancelAll(Collection&amp;lt;TimerTask&amp;gt; c) {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  for (TimerTask task : c)&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  task.cancel();&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="MsoNormal" align="left"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;Note the Collection c is of object type Timer Task according to the &amp;lt;Generic&amp;gt;declaration.This supposedly has the advantage that bad coding practices where users fail to check for correct object types in collection classes can be avoided. We have never liked generics and still do not for the hideously ugly and error prone syntax that it can result in. Supposedly reduced runtimes errors are replaced by greatly increased compile time errors and less understanding of what the code is doing. The following is much preferred to generics: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;void cancelAll(Collection c) {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  for (Object task : c)&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  if(task instanceof TimerTask)(TimerTask)task.cancel();&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="Section1" align="left"&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;This syntax requires an &lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;instanceof &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;validity check followed by a cast. Developers worked so hard to get languages with collection classes and containers which could hold different object types; don't shrink now. And if anyone has seen C++ code with generics especially where the relational operators &amp;gt; or &amp;lt; are involved they will know the devil of error-&amp;gt;prone non&amp;lt;-&amp;gt;understandability that has to be paid when generics get unleashed. For a counter point of view check &lt;a href="http://servlet.java.sun.com/javaone/sf2003/conf/bofs/display-3113.en.jsp" target="_blank"&gt;&lt;span style="color:black;"&gt;&lt;span style="color:windowtext;"&gt;"Adding generics to the Java programming language" &lt;/span&gt;&lt;/span&gt;&lt;/a&gt;at the Sun site. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="Section1" align="left"&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;2)Enhanced &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;em&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="FONT-WEIGHT: bold;font-family:Arial;color:windowtext;"  &gt;for&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/em&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt; loop&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt; brings the popular foreach construct into Java and use with arrays and collection classes. We have already used it in the example above where &lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;for (Object task : c) &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;should be read as "foreach Object task in the Collection c do the statement(s) below until all of the items in Collection c are retreived; then exit the loop". Foreach functionality in Perl and PHP have made the use of associative arrays and hashes very easy. Note the enhanced &lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;for&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt; works with arrays: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;int sum(int[] a) {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  int result = 0;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  for (int i : a) //Note our foreach usage here&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;   result += i;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;   return result;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="Section1" align="left"&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;3)Auto-boxing/unboxing&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt; - C# coders really take Java to task for lack of auto-boxing facilities. Thus the following:&lt;br /&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;Integer ii = (Integer) 66;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;i&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;//Will be relaxed to the much more natural&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;Integer ii = 66;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;b&gt;&lt;span style="FONT-WEIGHT: bold"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;C# programmers will get no arguments from this quarter as auto-boxing/unboxing reduces dumb compiler errors when boolean, int , double, float and other primitive Java types are used with their object counterparts.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;4)enums -&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt; The first reaction is hohum, they have done enums finally catching up with C, C++, C#, etc.&lt;br /&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;enum Seasons { fall, winter, spring, summer;}&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;i&gt;&lt;span style="FONT-STYLE: italic"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;looks pretty straightforward. But each enum is treated as a class declaration in Java with no public constructor. So then very powerful methods and other functionality can be attached to an enum as in: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;public enum Coin {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  penny(1), nickel(5), dime(10), quarter(25);&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  Coin(int value) { this.value = value; }&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  private final int value;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  public int value() { return value; }&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="MsoNormal" align="left"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;Suddenly enums can return meaningful values and do more useful things. See the following Java Community Process &lt;a href="http://jcp.org/aboutJava/communityprocess/jsr/tiger/enum.html" target="_blank"&gt;&lt;span style="color:black;"&gt;&lt;span style="color:windowtext;"&gt;paper&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; for other intriguing uses of enums.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;5)import static &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;- allows importing static member functions or constants from a class with the usual syntax but without having to inherit from the class. This can eliminate some tedious syntax repetitions as shown below: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;import static java.lang.Math.*;&lt;br /&gt;import static java.awt.BorderLayout.*;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;                                              ...&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;//The old Math references&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;xx=Math.sqrt(Math.PI);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;//the new Math references&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;double xNeway = sqrt(PI);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;//Note similar, simplified references to java.awt.BorderLayout constants&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;getContentPane().add(new JPanel(), CENTER);&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="Section1" align="left"&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;This is another welcome usability improvement to Java.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;6)varargs - &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;allows for a varriable number of arguments to be passed to a method using the "..." syntax as show in the example below: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;    &lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;void argtest(Object ... args) {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;      for (int i=0;i &amp;lt; args.length; i++) {&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="FONT-STYLE: italic;font-family:Arial;color:windowtext;"  &gt;&lt;br /&gt; &lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;        System.out.println("The value is "+args[i]+"\n");&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;      }&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;    }  &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;    argtest("test", "data");&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="Section1" align="left"&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;This functionality allows the incorporation of the &lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;printf()&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt; formatted output to Java as in: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;               System.out.printf("name count\n");&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div align="left"&gt;&lt;pre&gt;&lt;em&gt;&lt;i&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;  System.out.printf("%s %5d\n", user,total);&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/em&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p class="Section1" align="left"&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;In general, variable argument lists only through the command line has been a Java bane until now. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="Section1" align="left"&gt;&lt;strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;Other Significant Changes&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="FONT-WEIGHT: bold;font-family:Arial;color:windowtext;"  &gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;color:black;"&gt;&lt;span style="font-family:Arial;color:windowtext;"&gt;It would be a major mistake to characterize the 1.5 update as being primarily updates to streamline the syntax of the language. There are a number of other major changes to the Java class libraries and execution environ. For example, there are updates to the thread classes and concurrency utilities including adding of streamlined semaphore coding. The new metadata construct when combined with the reflection classes will allow program generation facilities to make much more "user-informed" decisions of what to do. The new JAXP XML facilities provide core XML platform support including XML 1.1 and Namespace, XML Schema. SAX 2.0.1. XSLT and the fast XLSTC compiler, and finally DOM Level 3. However, Web Services extension appear to be slated for a 1.5.x update. But it appears Simple Authentication and Security Layer (SASL) Java API may well make this version release. There are also new Java Platform profiling capabilities for the many new devices and platforms Java runs on and needs to be optimized for. There are a set of new Monitoring and Management Specification for the Java Virtual Machine which will help to manage and optimize runtime performance . In sum, Sun appears to be stocking Java with a full range of improvements that will make J2SE a very compelling upgrade; hopefully to go along with some of the rumored developmental tool improvements. The Java One Conference should be most interesting this year.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="left"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112684276146942217?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112684276146942217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112684276146942217&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112684276146942217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112684276146942217'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/introduction-to-new-tiger-version-of.html' title='Introduction to new Tiger version of Java and 6 major syntax changes'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112676214699656740</id><published>2005-09-11T22:45:00.000-07:00</published><updated>2005-09-17T06:12:25.613-07:00</updated><title type='text'>Java Interview Questions - Concluding Part</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;What are the steps involved in Applet development?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Following are the steps involved in Applet development:&lt;br /&gt;Create/Edit a Java source file. This file must contain a class which extends Applet class.&lt;br /&gt;Compile your program using javac&lt;br /&gt;Execute the appletviewer, specifying the name of your applet’s source file or html file. In case the applet information is stored in html file then Applet can be invoked using java enabled web browser.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Which method is used to output a string to an applet?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Which function is this method included in?&lt;br /&gt; drawString( ) method is used to output a string to an applet. This method is included in the paint method of the Applet.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Why we can not extends two classes in Java?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Trying to extend 2 classes, or multiple inheritence, would result in a few problems. One of it is when you use the super() method. If you use that while extending more then 1 class, which superclass are you referring to then? Java solves this problem by thus using implementations for its multiple inheritence purposes.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What gives Java its “write once and run anywhere” nature?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform. After being fed to the JVM, which is specific to a particular operating system, the code platform specific machine code is generated thus making java platform independent.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are the four corner stones of OOP?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Abstraction, Encapsulation, Polymorphism and Inheritance.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Difference between a Class and an Object?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;A class is a definition or prototype whereas an object is an instance or living representation of the prototype. &lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the difference between method overriding and overloading?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Overriding is a method with the same name and arguments as in a parent, whereas overloading is the same method name but different arguments.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is a “stateless” protocol?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Without getting into lengthy debates, it is generally accepted that protocols like HTTP are stateless i.e. there is no retention of state between a transaction which is a single request response combination.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is constructor chaining and how is it achieved in Java?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;A child object constructor always first needs to construct its parent (which in turn calls its parent constructor.). In Java it is done via an implicit call to the no-args constructor as the first statement.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is passed by ref and what by value?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;All Java method arguments are passed by value. However, Java does manipulate objects by reference, and all object variables themselves are references&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can RMI and Corba based applications interact?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Yes they can. RMI is available with IIOP as the transport protocol instead of JRMP.&lt;br /&gt;You can create a String object as String str = “abc"; Why cant a button object be created as Button bt = “abc";? Explain - The main reason you cannot create a button by Button bt1= “abc"; is because “abc” is a literal string (something slightly different than a String object, by the way) and bt1 is a Button object. The only object in Java that can be assigned a literal String is java.lang.String. Important to note that you are NOT calling a java.lang.String constuctor when you type String s = “abc";&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What does the “abstract” keyword mean in front of a method? A class?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Abstract keyword declares either a method or a class. If a method has a abstract keyword in front of it,it is called abstract method.Abstract method hs no body.It has only arguments and return type.Abstract methods act as placeholder methods that are implemented in the subclasses. Abstract classes can’t be instantiated.If a class is declared as abstract,no objects of that class can be created.If a class contains any abstract method it must be declared as abstract.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How many methods do u implement if implement the Serializable Interface?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The Serializable interface is just a “marker” interface, with no methods of its own to implement. Other ‘marker’ interfaces are&lt;br /&gt;            java.rmi.Remote&lt;br /&gt;            java.util.EventListener&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. import java.net.* versus import java.net.Socket)? &lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;It makes no difference in the generated class files since only the classes that are actually used are referenced by the generated class file. There is another practical benefit to importing single classes, and this arises when two (or more) packages have classes with the same name. Take java.util.Timer and javax.swing.Timer, for example. If I import java.util.* and javax.swing.* and then try to use “Timer", I get an error while compiling (the class name is ambiguous between both packages). Let’s say what you really wanted was the javax.swing.Timer class, and the only classes you plan on using in java.util are Collection and HashMap. In this case, some people will prefer to import java.util.Collection and import java.util.HashMap instead of importing java.util.*. This will now allow them to use Timer, Collection, HashMap, and other javax.swing classes without using fully qualified class names in.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the difference between logical data independence and physical data independence?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Logical Data Independence - meaning immunity of external schemas to changeds in conceptual schema. Physical Data Independence - meaning immunity of conceptual schema to changes in the internal schema.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is a user-defined exception?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Apart from the exceptions already defined in Java package libraries, user can define his own exception classes by extending Exception class.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Describe the visitor design pattern?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Represents an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates. The root of a class hierarchy defines an abstract method to accept a visitor. Subclasses implement this method with visitor.visit(this). The Visitor interface has visit methods for all subclasses of the baseclass in the hierarchy.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What methods can be overridden in Java?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;In C++ terminology, all public methods in Java are virtual. Therefore, all Java methods can be overwritten in subclasses except those that are declared final, static, and private.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can there be an abstract class with no abstract methods in it?&lt;/u&gt;&lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Yes&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;Can an Interface be final?&lt;/u&gt;&lt;/strong&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;No&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112676214699656740?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112676214699656740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112676214699656740&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676214699656740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676214699656740'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-concluding.html' title='Java Interview Questions - Concluding Part'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112676185170911618</id><published>2005-09-11T22:35:00.000-07:00</published><updated>2005-09-17T06:12:04.083-07:00</updated><title type='text'>Java Interview Questions - Part 6 of 7</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;How do Applets differ from Applications?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Following are the main differences: Application: Stand Alone, doesn’t need&lt;br /&gt;web-browser. Applet: Needs no explicit installation on local machine. Can be transferred through Internet on to the local machine and may run as part of web-browser. Application: Execution starts with main() method. Doesn’t work if main is not there. Applet: Execution starts with init() method. Application: May or may not be a GUI. Applet: Must run within a GUI (Using AWT). This is essential feature of applets.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;Can we pass parameters to an applet from HTML page to an applet? How? &lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;We can pass parameters to an applet using &lt;param&gt; tag in the following way:&lt;br /&gt;&lt;param name="param1? value="&gt;&lt;br /&gt;&lt;param name="param2? value="&gt;&lt;br /&gt;Access those parameters inside the applet is done by calling getParameter() method inside the applet. Note that getParameter() method returns String value corresponding to the parameter name.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How do we read number information from my applet’s parameters, given that Applet’s getParameter() method returns a string?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Use the parseInt() method in the Integer Class, the Float(String) constructor or parseFloat() method in the Class Float, or the&lt;br /&gt;Double(String) constructor or parseDoulbl() method in the class Double.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How can I arrange for different applets on a web page to communicate with each other?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Name your applets inside the Applet tag and invoke AppletContext’s getApplet() method in your applet code to obtain references to the other applets on the page.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How do I select a URL from my Applet and send the browser to that page?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Ask the applet for its applet context and invoke showDocument() on that context object.&lt;br /&gt;&lt;br /&gt;URL targetURL;&lt;br /&gt;String URLString&lt;br /&gt;AppletContext context = getAppletContext();&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;            targetURL = new URL(URLString);&lt;br /&gt;}&lt;br /&gt;catch (MalformedURLException e)&lt;br /&gt;{&lt;br /&gt;            // Code for recover from the exception&lt;br /&gt;}&lt;br /&gt;context. showDocument (targetURL);&lt;br /&gt;Can applets on different pages communicate with each other?&lt;br /&gt;-          No, Not Directly. The applets will exchange the information at one meeting place either on the local file system or at remote system.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How do I determine the width and height of my application?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Use the getSize() method, which the Applet class inherits from the Component class in the Java.awt package. The getSize() method returns the size of the applet as a Dimension object, from which you extract separate width, height fields. The following code snippet explains this:&lt;br /&gt;&lt;br /&gt;Dimension dim = getSize();&lt;br /&gt;int appletwidth = dim.width();&lt;br /&gt;int appletheight = dim.height();&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Which classes and interfaces does Applet class consist?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Applet class consists of a single class, the Applet class and three interfaces: AppletContext, AppletStub, and AudioClip.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is AppletStub Interface?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The applet stub interface provides the means by which an applet and the browser communicate. Your code will not typically implement this interface.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What tags are mandatory when creating HTML to display an applet?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;name, height, width&lt;br /&gt;code, name&lt;br /&gt;codebase, height, width&lt;br /&gt;code, height, width&lt;br /&gt;Correct answer is d.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are the Applet’s information methods?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The following are the Applet’s information methods: getAppletInfo() method: Returns a string describing the applet, its author, copyright information, etc. getParameterInfo( ) method: Returns an array of string describing the applet’s parameters.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112676185170911618?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112676185170911618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112676185170911618&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676185170911618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676185170911618'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-part-6-of-7.html' title='Java Interview Questions - Part 6 of 7'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112676165448313204</id><published>2005-09-11T22:16:00.000-07:00</published><updated>2005-09-17T06:06:34.196-07:00</updated><title type='text'>Java Interview Questions - Part 5 of 7</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;Is “abc” a primitive value?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The String literal “abc” is not a primitive value. It is a String object.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What restrictions are placed on the values of each case of a switch statement? &lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the query used to display all tables names in SQL Server (Query analyzer)?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;select * from information_schema.tables&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Is it possible to write two EJB’s that share the same Remote and Home interfaces, and have different bean classes? if so, what are the advantages/disadvantages?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;It’s certainly possible. In fact, there’s an example that ships with the Inprise Application Server of an Account interface with separate implementations for CheckingAccount and SavingsAccount, one of which was CMP and one of which was BMP.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is garbage collection?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;What is the process that is responsible for doing that in java? - Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What kind of thread is the Garbage collector thread?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;It is a daemon thread.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is a Marker Interface?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;An interface with no methods. Example: Serializable, Remote, Cloneable&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What interface do you implement to do the sorting?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Comparable&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the eligibility for a object to get cloned?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;It must implement the Cloneable interface&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;J2EE EJB interview questions&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the relationship between local interfaces and container-managed relationships?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Entity beans that have container-managed relationships with other entity beans, must be accessed in the same local scope as those related beans, and therefore typically provide a local client view. In order to be the target of a container-managed relationship, an entity bean with container-managed persistence must provide a local interface.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What does a remove method do for different cases of beans?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Stateless Session : Does not do anything to the bean as moving the bean from free pool to cache are managed by the container depending on load. Stateful Session: Removes the bean from the cache. Entity Bean: Deletes the bean (data) from persistent storage&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How does a container-managed relationship work?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;An entity bean accesses related entity beans by means of the accessor methods for its container-managed relationship fields, which are specified by the cmr-field elements of its abstract persistence schema defined in the deployment descriptor. Entity bean relationships are defined in terms of the local interfaces of the related beans, and the view an entity bean presents to its related beans is defined by its local home and local interfaces. Thus, an entity bean can be the target of a relationship from another entity bean only if it has a local interface.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is an Applet? Should applets have constructors?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Applets are small programs transferred through Internet, automatically installed and run as part of web-browser. Applets implements functionality of a client. Applet is a dynamic and interactive program that runs inside a Web page displayed by a Java-capable browser. We don’t have the concept of Constructors in Applets. Applets can be invoked either through browser or through Appletviewer utility provided by JDK.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are the Applet’s Life Cycle methods? Explain them?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Following are methods in the life cycle of an Applet:&lt;br /&gt;init() method - called when an applet is first loaded. This method is called only once in the entire cycle of an applet. This method usually intialize the variables to be used in the applet.&lt;br /&gt;start( ) method - called each time an applet is started.&lt;br /&gt;paint() method - called when the applet is minimized or refreshed. This method is used for drawing different strings, figures, and images on the applet window.&lt;br /&gt;stop( ) method - called when the browser moves off the applet’s page.&lt;br /&gt;destroy( ) method - called when the browser is finished with the applet.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the sequence for calling the methods by AWT for applets?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;When an applet begins, the AWT calls the following methods, in this sequence:&lt;br /&gt;init()&lt;br /&gt;start()&lt;br /&gt;paint()&lt;br /&gt;When an applet is terminated, the following sequence of method calls takes place :&lt;br /&gt;&lt;br /&gt;stop()&lt;br /&gt;destroy()&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112676165448313204?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112676165448313204/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112676165448313204&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676165448313204'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676165448313204'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-part-5-of-7.html' title='Java Interview Questions - Part 5 of 7'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112676133233967430</id><published>2005-09-11T10:11:00.000-07:00</published><updated>2005-09-17T06:04:42.146-07:00</updated><title type='text'>Java Interview Questions - Part 4 of 7</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;What is a native method?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;A native method is a method that is implemented in a language other than Java.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are order of precedence and associativity, and how are they used?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Order of precedence determines the order in which operators are evaluated in expressions. Associatity determines whether an expression is evaluated left-to-right or right-to-left&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the catch or declare rule for method declarations?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;If a checked exception may be thrown within the body of a method, the method must either catch the exception or declare it in its throws clause.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can an anonymous class be declared as implementing an interface and extending a class?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the range of the char type?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The range of the char type is 0 to 2^16 - 1.&lt;br /&gt;----------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the purpose of finalization?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the difference between the Boolean &amp; operator and the &amp;amp;&amp; operator?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;If an expression involving the Boolean &amp;amp; operator is evaluated, both operands are evaluated. Then the &amp; operator is applied to the operand. When an expression involving the &amp;amp;&amp; operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The &amp;amp;&amp;amp; operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Struts&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is Jakarta Struts Framework?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is ActionServlet?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can we use the constructor, instead of init(), to initialize servlet?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Yes , of course you can use the constructor instead of init(). There’s nothing to stop you. But you shouldn’t. The original reason for init() was that ancient versions of Java couldn’t dynamically invoke constructors with arguments, so there was no way to give the constructur a ServletConfig. That no longer applies, but servlet containers still will only call your no-arg constructor. So you won’t have access to a ServletConfig or ServletContext.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How can a servlet refresh automatically if some new data has entered the database?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;You can use a client-side Refresh or Server Push.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;EJB interview questions&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Are enterprise beans allowed to use Thread.sleep()?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Enterprise beans make use of the services provided by the EJB container, such as life-cycle management. To avoid conflicts with these services, enterprise beans are restricted from performing certain operations: Managing or synchronizing threads&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Is is possible for an EJB client to marshal an object of class java.lang.Class to an EJB?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Technically yes, spec. compliant NO! - The enterprise bean must not attempt to query a class to obtain information about the declared members that are not otherwise accessible to the enterprise bean because of the security rules of the Java language.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Is it legal to have static initializer blocks in EJB?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods.&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112676133233967430?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112676133233967430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112676133233967430&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676133233967430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676133233967430'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-part-4-of-7.html' title='Java Interview Questions - Part 4 of 7'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112676103497894979</id><published>2005-09-10T22:07:00.000-07:00</published><updated>2005-09-17T06:11:35.156-07:00</updated><title type='text'>Java Interview Questions - Part 3 of 7</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;Difference between JRE/JVM/JDK?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Why do threads block on I/O? - Threads block on i/o (that is enters the waiting state) so that other threads may execute while the I/O operation is performed.&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is synchronization and why is it important?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object’s value. This often leads to significant errors.&lt;br /&gt;--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Is null a keyword?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The null value is not a keyword.&lt;br /&gt;--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can there be an abstract class with no abstract methods in it?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Yes&lt;br /&gt;--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can an Interface be final?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;No&lt;br /&gt;--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can an Interface have an inner class?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Yes.&lt;br /&gt;--------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Which characters may be used as the second character of an identifier,but not as the first character of an identifier?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The digits 0 through 9 may not be used as the first character of an identifier but they may be used after the first character of an identifier.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;What modifiers may be used with an inner class that is a member of an outer class? - A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are wrapped classes?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Wrapped classes are classes that allow primitive types to be accessed as objects.&lt;br /&gt;-------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What restrictions are placed on the location of a package statement within a source code file?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;A package statement must appear as the first line in a source code file (excluding blank lines and comments).&lt;br /&gt;-------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is the difference between preemptive scheduling and time slicing?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.&lt;br /&gt;-------------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112676103497894979?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112676103497894979/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112676103497894979&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676103497894979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676103497894979'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-part-3-of-7.html' title='Java Interview Questions - Part 3 of 7'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112676082320385443</id><published>2005-09-10T10:04:00.000-07:00</published><updated>2005-09-17T05:56:43.090-07:00</updated><title type='text'>Java Interview Questions - Part 2 of 7</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;u&gt;What are the different identifier states of a Thread?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;The different identifiers of a Thread are: R - Running or runnable thread, S - Suspended thread, CW - Thread waiting on a condition variable, MW - Thread waiting on a monitor lock, MS - Thread suspended waiting on a monitor lock&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What are some alternatives to inheritance?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Delegation is an alternative to inheritance. Delegation means that you include an instance of another class as an instance variable, and forward messages to the instance. It is often safer than inheritance because it forces you to think about each message you forward, because the instance is of a known class, rather than a new class, and because it doesn’t force you to accept all the methods of the super class: you can provide only the methods that really make sense. On the other hand, it makes you write more code, and it is harder to re-use (because it is not a subclass).&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Why isn’t there operator overloading?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Because C++ has proven by example that operator overloading makes code almost impossible to maintain. In fact there very nearly wasn’t even method overloading in Java, but it was thought that this was too useful for some very basic methods like print(). Note that some of the classes like DataOutputStream have unoverloaded methods like writeInt() and writeByte().&lt;br /&gt;---------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;u&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What does it mean that a method or field is “static"? &lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/u&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Static variables and methods are instantiated only once per class. In other words they are class variables, not instance variables. If you change the value of a static variable in a particular object, the value of that variable changes for all instances of that class. Static methods can be referenced with the name of the class rather than the name of a particular object of the class (though that works too). That’s how library methods like System.out.println() work. out is a static field in the java.lang.System class.&lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.sun.com?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;String hostname = InetAddress.getByName("192.18.97.39").getHostName();&lt;br /&gt;------------------------------------------------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112676082320385443?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112676082320385443/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112676082320385443&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676082320385443'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112676082320385443'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-part-2-of-7.html' title='Java Interview Questions - Part 2 of 7'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112658214085949398</id><published>2005-09-09T20:29:00.000-07:00</published><updated>2005-09-17T05:55:08.286-07:00</updated><title type='text'>Java Interview Questions - Part 1 of 7</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;strong&gt;&lt;u&gt;Can an Interface have an inner class? - Yes.&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;public interface abc&lt;br /&gt;{&lt;br /&gt;static int i=0; void dd();&lt;br /&gt;class a1&lt;br /&gt;{&lt;br /&gt;a1()&lt;br /&gt;{&lt;br /&gt;int j;&lt;br /&gt;System.out.println("inside");&lt;br /&gt;};&lt;br /&gt;public static void main(String a1[])&lt;br /&gt;{&lt;br /&gt;System.out.println("in interfia");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;Can we define private and protected modifiers for variables in interfaces?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;No&lt;br /&gt;-----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is Externalizable?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Externalizable is an Interface that extends Serializable Interface. And sends data into Streams in Compressed Format. It has two methods, writeExternal(ObjectOuput out) and readExternal(ObjectInput in)&lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What modifiers are allowed for methods in an Interface?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Only public and abstract modifiers are allowed for methods in interfaces.&lt;br /&gt;--------------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;What is a local, member and a class variable?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;Variables declared within a method are “local” variables. Variables declared within the class i.e not within any methods are “member” variables (global variables). Variables declared within the class i.e not within any methods and are defined as “static” are class variables&lt;br /&gt;----------------------------------------------------------------------------------------&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112658214085949398?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112658214085949398/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112658214085949398&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112658214085949398'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112658214085949398'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-part-1-of-7.html' title='Java Interview Questions - Part 1 of 7'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112623889319525190</id><published>2005-09-08T21:08:00.000-07:00</published><updated>2005-09-08T21:08:13.276-07:00</updated><title type='text'></title><content type='html'>&lt;div class=Section1&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;General Java Interview Questions&lt;br&gt; Core Java :&lt;br&gt; What is a virtual function in C++?&lt;br&gt; Simply put, the virtual keyword enables a function to be 'virtual' which then gives possibility for that function to be overridden (redefined) in one or more descendant classes. It is a good feature since the specific function to call is determined at run-time. In other words, a virtual function allows derived classes to replace the implementation provided by the base class. &lt;br&gt; &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; &lt;br&gt; What is the difference between private, protected, and public?&lt;br&gt; These keywords are for allowing privilages to components such as functions and variables. &lt;br&gt; Public: accessible to all classes&lt;br&gt; Private: accessible only to the class to which they belong&lt;br&gt; Protected: accessible to the class to which they belong and any subclasses.&lt;br&gt; &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is a cartesian product in PL/SQL?&lt;br&gt; When a Join condition is not specified by the programmer or is invalid(fails), PL/SQL forms a Cartesian product. &lt;br&gt; In a Cartesian product, all combinations of rows will be displayed.&lt;br&gt; For example, All rows in the first table are joined to all rows in the second table. It joins a bunch of rows and it's result is rarely useful unless you have a need to combine all rows from all tables. &lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; What is mutual exclusion? How can you take care of mutual exclusion using Java threads?&lt;br&gt; Mutual exclusion is where no two processes can access critical regions of memory at the same time.&lt;br&gt; Java provides many utilities to deal with mutual exclusion with the use of threaded programming.&lt;br&gt; For mutual exclusion, you can simply use the synchronized keyword and explicitly or implicitly provide an Object, any Object, to synchronize on.&lt;br&gt; The runtime system/Java compiler takes care of the gruesome details for you. The synchronized keyword can be applied to a class, to a method, or to a block of code. There are several methods in Java used for communicating mutually exclusive threads such as wait( ), notify( ), or notifyAll( ). For example, the notifyAll( ) method wakes up all threads that are in the wait list of an object. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are some advantages and disadvantages of Java Sockets?&lt;br&gt; Some advantages of Java Sockets:&lt;br&gt; &lt;br&gt; Sockets are flexible and sufficient. Efficient socket based programming can be easily implemented for general communications.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;&lt;br&gt; Sockets cause low network traffic. Unlike HTML forms and CGI scripts that generate and transfer whole web pages for each new request, Java applets can send only necessary updated information.&lt;br&gt; &lt;br&gt; Some disadvantages of Java Sockets:&lt;br&gt; &lt;br&gt; Security restrictions are sometimes overbearing because a Java applet running in a Web browser is only able to establish connections to the machine where it came from, and to nowhere else on the network&lt;br&gt; &lt;br&gt; Despite all of the useful and helpful Java features, Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way.&lt;br&gt; &lt;br&gt; Since the data formats and protocols remain application specific, the re-use of socket based implementations is limited.&lt;br&gt; &lt;br&gt; What is the difference between an Interface and an Abstract class? &lt;br&gt; An Abstract class declares have at least one instance method that is declared abstract which will be implemented by the subclasses. An abstract class can have instance methods that implement a default behavior. An Interface can only declare constants and instance methods, but cannot implement default behavior. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the purpose of garbage collection in Java, and when is it used?&lt;br&gt; The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Describe synchronization in respect to multithreading.?&lt;br&gt; With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible for one thread to modify a shared variable while another thread is in the process of using or updating same shared variable. This usually leads to significant errors. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Explain different way of using thread?&lt;br&gt; The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, 'cause when you are going for multiple inheritance..the only interface can help. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are pass by reference and passby value?&lt;br&gt; Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is HashMap and Map?&lt;br&gt; Map is Interface and Hashmap is class that implements that. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Difference between HashMap and HashTable?&lt;br&gt; The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesnt allow). HashMap does not guarantee that the order of the map will remain constant over time. HashMap is non synchronized and Hashtable is synchronized. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Difference between Vector and ArrayList?&lt;br&gt; Vector is synchronized whereas arraylist is not. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Difference between Swing and Awt?&lt;br&gt; AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between a constructor and a method?&lt;br&gt; A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is an Iterators?&lt;br&gt; Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allows you to walk a collection of objects, operating on each object in turn. Remember when using Iterators that they contain a snapshot of the collection at the time the Iterator was obtained; generally it is not advisable to modify the collection itself while traversing an Iterator. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; State the significance of public, private, protected, default modifiers both singly and in combination and state the effect of package relationships on declared items qualified by these modifiers.?&lt;br&gt; public : Public class is visible in other packages, field is visible everywhere (class must be public too) private : Private variables or methods may be used only by an instance of the same class that declares the variable or method, A private feature may only be accessed by the class that owns the feature. protected : Is available to all classes in the same package and also available to all subclasses of the class that owns the protected feature.This access is provided even to subclasses that reside in a different package from the class that owns the protected feature. default :What you get by default ie, without any access modifier (ie, public private or protected).It means that it is visible to all within a particular package. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is an abstract class?&lt;br&gt; Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not be instantiated (ie, you may not call its constructor), abstract class may contain static data. Any class with an abstract method is automatically abstract itself, and must be declared as such. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is static in java?&lt;br&gt; Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance of a class.Static methods are implicitly final, because overriding is done based on the type of the object, and static methods are attached to a class, not an object. A static method in a superclass can be shadowed by another static method in a subclass, as long as the original method was not declared final. However, you can't override a static method with a nonstatic method. In other words, you can't change a static method into an instance method in a subclass. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;---------------------------------------------------------------------------------&lt;br&gt; What is final?&lt;br&gt; A final class can't be extended ie., final class may not be subclassed. A final method can't be overridden when its class is inherited. You can't change value of a final variable (is a constant). &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Are the imports checked for validity at compile time? e.g. will the code containing an import such as java.lang.ABCD compile?&lt;br&gt; Yes the imports are checked for the semantic validity at compile time. The code containing above line of import will not compile. It will throw an error saying,can not resolve symbol symbol : class ABCD location: package io import java.io.ABCD; &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Does importing a package imports the subpackages as well?&lt;br&gt; e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*? &lt;br&gt; No you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of it's subpackage. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between declaring a variable and defining a variable?&lt;br&gt; In declaration we just mention the type of the variable and it's name. We do not initialize it. But defining means declaration + initialization. e.g String s; is just a declaration while String s = new String (&amp;quot;abcd&amp;quot;); Or String s = &amp;quot;abcd&amp;quot;; are both definitions. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the default value of an object reference declared as an instance variable?&lt;br&gt; null unless we define it explicitly. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can a level class be private or protected?&lt;br&gt; No. A level class can not be private or protected. It can have either &amp;quot;public&amp;quot; or no modifier. If it does not have a modifier it is supposed to have a default access.If a level class is declared as private the compiler will complain that the &amp;quot;modifier private is not allowed here&amp;quot;. This means that a level class can not be private. Same is the case with protected. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What type of parameter passing does Java support?&lt;br&gt; In Java the arguments are always passed by value . &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Primitive data types are passed by reference or pass by value?&lt;br&gt; Primitive data types are passed by value. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Objects are passed by value or by reference?&lt;br&gt; Java only supports pass by value. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object . &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is serialization?&lt;br&gt; Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How do I serialize an object to a file?&lt;br&gt; The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Which methods of Serializable interface should I implement?&lt;br&gt; The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How can I customize the seralization process?&lt;br&gt; i.e. how can one have a control over the serialization process? &lt;br&gt; Yes it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is an abstract class?&lt;br&gt; Abstract class must be extended/subclassed (to be useful). It serves as a template. A class that is abstract may not be instantiated (ie, you may not call its constructor), abstract class may contain static data. Any class with an abstract method is automatically abstract itself, and must be declared as such. A class may be declared abstract even if it has no abstract methods. This prevents it from being instantiated. &lt;br&gt; ---------------------------------------------------------------------------------&lt;br&gt; What is the common usage of serialization?&lt;br&gt; Whenever an object is to be sent over the network, objects need to be serialized. Moreover if the state of an object is to be saved, objects need to be serilazed. &lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; What is Externalizable interface?&lt;br&gt; Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by implementing these methods. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What happens to the object references included in the object?&lt;br&gt; The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is serialized, all the included objects are also serialized alongwith the original obect. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What one should take care of while serializing the object?&lt;br&gt; One should make sure that all the included objects are also serializable. If any of the objects is not serializable then it throws a NotSerializableException. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What if the main method is declared as private?&lt;br&gt; The program compiles properly but at runtime it will give &amp;quot;Main method not public.&amp;quot; message. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What if the static modifier is removed from the signature of the main method?&lt;br&gt; Program compiles. But at runtime throws an error &amp;quot;NoSuchMethodError&amp;quot;. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What if I write static public void instead of public static void?&lt;br&gt; Program compiles and runs properly. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What if I do not provide the String array as the argument to the method?&lt;br&gt; Program compiles but throws a runtime error &amp;quot;NoSuchMethodError&amp;quot;. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the first argument of the String array in main method?&lt;br&gt; The String array is empty. It does not have any element. This is unlike C/C++ where the first element by default is the program name. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; If I do not provide any arguments on the command line, then the String array of Main method will be empty of null?&lt;br&gt; It is empty. But not null. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How can one prove that the array is not null but empty?&lt;br&gt; Print args.length. It will print 0. That means it is empty. But if it would have been null then it would have thrown a NullPointerException on attempting to print args.length. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What environment variables do I need to set on my machine in order to be able to run Java programs?&lt;br&gt; CLASSPATH and PATH are the two variables. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can an application have multiple classes having main method?&lt;br&gt; Yes it is possible. While starting the application we mention the class name to be run. The JVM will look for the Main method only in the class whose name you have mentioned. Hence there is not conflict amongst the multiple classes having main method. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can I have multiple main methods in the same class?&lt;br&gt; No the program fails to compile. The compiler says that the main method is already defined in the class. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Do I need to import java.lang package any time? Why ?&lt;br&gt; No. It is by default loaded internally by the JVM. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can I import same package/class twice?&lt;br&gt; Will the JVM load the package twice at runtime? &lt;br&gt; One can import the same package or same class multiple times. Neither compiler nor JVM complains abt it. And the JVM will internally load the class only once no matter how many times you import the same class. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are Checked and UnChecked Exception?&lt;br&gt; A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked forces client programmers to deal with the possibility that the exception will be thrown. eg, IOException thrown by java.io.FileInputStream's read() method &lt;br&gt; ----------------------------------------------------------------------------------&lt;br&gt; checked exceptions are RuntimeException and any of its subclasses. Class Error and its subclasses also are unchecked. With an unchecked exception, however, the compiler doesn't force client programmers either to catch the exception or declare it in a throws clause. In fact, client programmers may not even know that the exception could be thrown. eg, StringIndexOutOfBoundsException thrown by String's charAt() method Checked exceptions must be caught at compile time. Runtime exceptions do not need to be. Errors often cannot be. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is Overriding?&lt;br&gt; When a class defines a method using the same name, return type, and arguments as a method in its superclass, the method in the class overrides the method in the superclass. When the method is invoked for an object of the class, it is the new definition of the method that is called, and not the method definition from superclass. Methods may be overridden to be more public, not more private. &lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; What are different types of inner classes?&lt;br&gt; They are &lt;br&gt; Nested -level classes, Member classes, Local classes, Anonymous classes&lt;br&gt; &lt;br&gt; Nested -level classes- If you declare a class within a class and specify the static modifier, the compiler treats the class just like any other -level class. Any class outside the declaring class accesses the nested class with the declaring class name acting similarly to a package. eg, outer.inner. -level inner classes implicitly have access only to static variables.There can also be inner interfaces. All of these are of the nested -level variety.&lt;br&gt; &lt;br&gt; Member classes - Member inner classes are just like other member methods and member variables and access to the member class is restricted, just like methods and variables. This means a public member class acts similarly to a nested -level class. The primary difference between member classes and nested -level classes is that member classes have access to the specific instance of the enclosing class.&lt;br&gt; &lt;br&gt; Local classes - Local classes are like local variables, specific to a block of code. Their visibility is only within the block of their declaration. In order for the class to be useful beyond the declaration block, it would need to implement a more publicly available interface.Because local classes are not members, the modifiers public, protected, private, and static are not usable.&lt;br&gt; &lt;br&gt; Anonymous classes - Anonymous inner classes extend local inner classes one level further. As anonymous classes have no name, you cannot provide a constructor. &lt;br&gt; &lt;br&gt; -----------------------------------------------------------------------------------&lt;br&gt; Are the imports checked for validity at compile time? e.g. will the code containing an import such as java.lang.ABCD compile?&lt;br&gt; Yes the imports are checked for the semantic validity at compile time. The code containing above line of import will not compile. It will throw an error saying,can not resolve symbol symbol : class ABCD location: package io import java.io.ABCD; &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Does importing a package imports the subpackages as well? e.g. Does importing com.MyTest.* also import com.MyTest.UnitTests.*?&lt;br&gt; No you will have to import the subpackages explicitly. Importing com.MyTest.* will import classes in the package MyTest only. It will not import any class in any of it's subpackage. &lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; What is the difference between declaring a variable and defining a variable?&lt;br&gt; In declaration we just mention the type of the variable and it's name. We do not initialize it. But defining means declaration + initialization. e.g String s; is just a declaration while String s = new String (&amp;quot;abcd&amp;quot;); Or String s = &amp;quot;abcd&amp;quot;; are both definitions. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the default value of an object reference declared as an instance variable?&lt;br&gt; null unless we define it explicitly. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can a level class be private or protected?&lt;br&gt; No. A level class can not be private or protected. It can have either &amp;quot;public&amp;quot; or no modifier. If it does not have a modifier it is supposed to have a default access.If a level class is declared as private the compiler will complain that the &amp;quot;modifier private is not allowed here&amp;quot;. This means that a level class can not be private. Same is the case with protected. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What type of parameter passing does Java support?&lt;br&gt; In Java the arguments are always passed by value . &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Primitive data types are passed by reference or pass by value?&lt;br&gt; Primitive data types are passed by value. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Objects are passed by value or by reference?&lt;br&gt; Java only supports pass by value. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object . &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is serialization?&lt;br&gt; Serialization is a mechanism by which you can save the state of an object by converting it to a byte stream. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How do I serialize an object to a file?&lt;br&gt; The class whose instances are to be serialized should implement an interface Serializable. Then you pass the instance to the ObjectOutputStream which is connected to a fileoutputstream. This will save the object to a file. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Which methods of Serializable interface should I implement?&lt;br&gt; The serializable interface is an empty interface, it does not contain any methods. So we do not implement any methods. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How can I customize the seralization process?&lt;br&gt; i.e. how can one have a control over the serialization process? &lt;br&gt; Yes it is possible to have control over serialization process. The class should implement Externalizable interface. This interface contains two methods namely readExternal and writeExternal. You should implement these methods and write the logic for customizing the serialization process. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the common usage of serialization?&lt;br&gt; Whenever an object is to be sent over the network, objects need to be serialized. Moreover if the state of an object is to be saved, objects need to be serilazed. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is Externalizable interface?&lt;br&gt; Externalizable is an interface which contains two methods readExternal and writeExternal. These methods give you a control over the serialization mechanism. Thus if your class implements this interface, you can customize the serialization process by implementing these methods. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What happens to the object references included in the object?&lt;br&gt; The serialization mechanism generates an object graph for serialization. Thus it determines whether the included object references are serializable or not. This is a recursive process. Thus when an object is serialized, all the included objects are also serialized alongwith the original obect. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What one should take care of while serializing the object?&lt;br&gt; One should make sure that all the included objects are also serializable. If any of the objects is not serializable then it throws a NotSerializableException. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What happens to the static fields of a class during serialization?&lt;br&gt; Are these fields serialized as a part of each serialized object? &lt;br&gt; Yes the static fields do get serialized. If the static field is an object then it must have implemented Serializable interface. The static fields are serialized as a part of every object. But the commonness of the static fields across all the instances is maintained even after serialization. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How are Observer and Observable used?&lt;br&gt; Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects. [Received from Venkateswara Manam] &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is synchronization and why is it important?&lt;br&gt; With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often leads to significant errors. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How does Java handle integer overflows and underflows?&lt;br&gt; It uses those low order bytes of the result that can fit into the size of the type allowed by the operation. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Does garbage collection guarantee that a program will not run out of memory?&lt;br&gt; Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection . &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between preemptive scheduling and time slicing?&lt;br&gt; Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; When a thread is created and started, what is its initial state?&lt;br&gt; A thread is in the ready state after it has been created and started. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the purpose of finalization?&lt;br&gt; The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the Locale class?&lt;br&gt; The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between a while statement and a do statement?&lt;br&gt; A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between static and non-static variables?&lt;br&gt; A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How are this() and super() used with constructors?&lt;br&gt; this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor. &lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; &lt;b&gt;&lt;span style='font-weight:bold'&gt;Servlets:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;&lt;br&gt; Explain the life cycle methods of a Servlet. &lt;br&gt; The javax.servlet.Servlet interface defines the three methods known as life-cycle method. public void init(ServletConfig config) throws ServletException public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException public void destroy() First the servlet is constructed, then initialized wih the init() method. Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet. The servlet is removed from service, destroyed with the destroy() methid, then garbaged collected and finalized. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between the getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface and javax.servlet.ServletContext interface? &lt;br&gt; The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a &amp;quot;/&amp;quot; it is interpreted as relative to the current context root. &lt;br&gt; The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must sart with a &amp;quot;/&amp;quot; and are interpreted as relative to curent context root. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Explain the directory structure of a web application. &lt;br&gt; The directory structure of a web application consists of two parts. A private directory called WEB-INF A public resource directory which contains public resource folder. WEB-INF folder consists of 1. web.xml&lt;br&gt; 2. classes directory&lt;br&gt; 3. lib directory&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are the common mechanisms used for session tracking? &lt;br&gt; Cookies SSL sessions URL- rewriting &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Explain ServletContext. &lt;br&gt; ServletContext interface is a window for a servlet to view it's environment. A servlet can use this interface to get information such as initialization parameters for the web applicationor servlet container's version. Every web application has one and only one ServletContext and is accessible to all active resource of that application. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is preinitialization of a servlet? &lt;br&gt; A container doesnot initialize the servlets ass soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between Difference between doGet() and doPost()? &lt;br&gt; A doGet() method is limited with 2k of data to be sent, and doPost() method doesn't have this limitation. A request string for doGet() looks like the following: &lt;a href="http://www.allapplabs.com/svt1?p1=v1&amp;amp;p2=v2&amp;amp;...&amp;amp;pN=vN"&gt;http://www.allapplabs.com/svt1?p1=v1&amp;amp;p2=v2&amp;amp;...&amp;amp;pN=vN&lt;/a&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;&lt;br&gt; doPost() method call doesn't need a long text tail after a servlet name in a request. All parameters are stored in a request itself, not in a request string, and it's impossible to guess the data transmitted to a servlet only looking at a request string. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between HttpServlet and GenericServlet? &lt;br&gt; A GenericServlet has a service() method aimed to handle requests.&lt;br&gt; HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1). Both these classes are abstract. &lt;br&gt; ---------------------------------------------------------------------------------&lt;br&gt; &lt;b&gt;&lt;span style='font-weight:bold'&gt;JSP:&lt;br&gt; &lt;/span&gt;&lt;/b&gt;What is a output comment? &lt;br&gt; A comment that is sent to the client in the viewable page source.The JSP engine handles an output comment as uninterpreted HTML text, returning the comment in the HTML output sent to the client. You can see the comment by viewing the page source from your Web browser. JSP Syntax Example 1 Displays in the page source: &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is a Hidden Comment? &lt;br&gt; A comments that documents the JSP page but is not sent to the client. The JSP engine ignores a hidden comment, and does not process any code within hidden comment tags. A hidden comment is not sent to the client, either in the displayed JSP page or the HTML page source. The hidden comment is useful when you want to hide or &amp;quot;comment out&amp;quot; part of your JSP page. You can use any characters in the body of the comment except the closing --%&amp;gt; combination. If you need to use --%&amp;gt; in your comment, you can escape it by typing --%\&amp;gt;. JSP Syntax Examples &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is a _Expression? &lt;br&gt; An _expression tag contains a scripting language _expression that is evaluated, converted to a String, and inserted where the _expression appears in the JSP file. Because the value of an _expression is converted to a String, you can use an _expression within text in a JSP file. Like You cannot use a semicolon to end an _expression &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is a Declaration? &lt;br&gt; A declaration declares one or more variables or methods for use later in the JSP source file. A declaration must contain at least one complete declarative statement. You can declare any number of variables or methods within one declaration tag, as long as they are separated by semicolons. The declaration must be valid in the scripting language used in the JSP file. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is a Scriptlet? &lt;br&gt; A scriptlet can contain any number of language statements, variable or method declarations, or expressions that are valid in the page scripting language.Within scriptlet tags, you can &lt;br&gt; &lt;br&gt; 1.Declare variables or methods to use later in the file (see also Declaration).&lt;br&gt; &lt;br&gt; 2.Write expressions valid in the page scripting language (see also _Expression). &lt;br&gt; &lt;br&gt; 3.Use any of the JSP implicit objects or any object declared with a tag.&lt;br&gt; &lt;br&gt; You must write plain text, HTML-encoded text, or other JSP tags outside the scriptlet. Scriptlets are executed at request time, when the JSP engine processes the client request. If the scriptlet produces output, the output is stored in the out object, from which you can display it. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are implicit objects? List them? &lt;br&gt; Certain objects that are available for the use in JSP documents without being declared first. These objects are parsed by the JSP engine and inserted into the generated servlet. The implicit objects re listed below request response pageContext session application out config page exception &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Difference between forward and sendRedirect? &lt;br&gt; When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completly with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completly new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forward. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are the different scope valiues for the ? &lt;br&gt; The different scope values for are &lt;br&gt; 1. page&lt;br&gt; 2. request&lt;br&gt; 3.session&lt;br&gt; 4.application &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Explain the life-cycle mehtods in JSP? &lt;br&gt; THe generated servlet class for a JSP page implements the HttpJspPage interface of the javax.servlet.jsp package. Hte HttpJspPage interface extends the JspPage interface which inturn extends the Servlet interface of the javax.servlet package. the generated servlet class thus implements all the methods of the these three interfaces.&lt;br&gt; &lt;br&gt; The JspPage interface declares only two mehtods - jspInit() and jspDestroy() that must be implemented by all JSP pages regardless of the client-server protocol.&lt;br&gt; &lt;br&gt; However the JSP specification has provided the HttpJspPage interfaec specifically for the JSp pages serving HTTP requests.&lt;br&gt; This interface declares one method _jspService(). The jspInit()- The container calls the jspInit() to initialize te servlet instance.It is called before any other method, and is called only once for a servlet instance. &lt;br&gt; The _jspservice()- The container calls the _jspservice() for each request, passing it the request and the response objects. &lt;br&gt; The jspDestroy()- The container calls this when it decides take the instance out of service. It is the last method called n the servlet instance. &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=post-footer&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black;text-transform:uppercase; letter-spacing:1.2pt'&gt;posted by Arpan The Progress at &lt;a href="http://arpanrajani3.blogspot.com/2005/08/java.html" title="permanent link"&gt;&lt;font color=black&gt;&lt;span style='color:black'&gt;12:17 AM&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/font&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family: Arial;color:black'&gt; &lt;a href="http://www.blogger.com/comment.g?blogID=14918590&amp;amp;postID=112452230748780597" location.href="http://www.blogger.com/comment.g?blogID=14918590&amp;amp;postID=112452230748780597;"&gt;&lt;font color=black&gt;&lt;span style='color:black;text-transform:uppercase;letter-spacing: 1.2pt'&gt;0 comments&lt;/span&gt;&lt;/font&gt;&lt;/a&gt; &lt;span class=item-controladmin-216855999pid-1724274500&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=14918590&amp;amp;postID=112452230748780597&amp;amp;quickEdit=true" title="Edit Post"&gt;&lt;span class=quick-edit-icon1&gt;&lt;font color=black&gt;&lt;span style='color:black;border:none windowtext 1.0pt;padding:0in;text-decoration: none'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt; &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;!-- End .post --&gt;&lt;!-- Begin #comments --&gt;&lt;!-- End #comments --&gt;&lt;!-- Begin .post --&gt;  &lt;h3 style='margin-right:0in;margin-bottom:0in;margin-left:0in;margin-bottom: .0001pt;line-height:16.8pt'&gt;&lt;a name=112452221455059692&gt;&lt;/a&gt;&lt;b&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial; color:black;font-weight:normal'&gt;C++ &lt;/span&gt;&lt;/font&gt;&lt;/b&gt;&lt;/h3&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;C++ Interview Questions&lt;br&gt; &lt;br&gt; Is it possible to have Virtual Constructor? If yes, how?If not, Why not possible ?&lt;br&gt; There is nothing like Virtual Constructor.&lt;br&gt; The Constructor cant be virtual as the constructor is a code which is responsible for creating a instance of a class and it cant be delegated to any other object by virtual keyword means. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What about Virtual Destructor?&lt;br&gt; Yes there is a Virtual Destructor. A destructor can be virtual as it is possible as at runtime depending on the type of object baller is balling to , proper destructor will be called. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is Pure Virtual Function? Why and when it is used ?&lt;br&gt; The abstract class whose pure virtual method has to be implemented by all the classes which derive on these. Otherwise it would result in a compilation error.&lt;br&gt; This construct should be used when one wants to ensure that all the derived classes implement the method defined as pure virtual in base class. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is problem with Runtime type identification?&lt;br&gt; The run time type identification comes at a cost of performance penalty. Compiler maintains the class.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How Virtual functions call up is maintained?&lt;br&gt; Through Look up tables added by the compile to every class image. This also leads to performance penalty.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can inline functions have a recursion?&lt;br&gt; No.&lt;br&gt; Syntax wise It is allowed. But then the function is no longer Inline. As the compiler will never know how deep the recursion is at compilation time.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How do you link a C++ program to C functions?&lt;br&gt; By using the extern &amp;quot;C&amp;quot; linkage specification around the C function declarations.&lt;br&gt; Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern &amp;quot;C&amp;quot; linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Explain the scope resolution operator?&lt;br&gt; It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How many ways are there to initialize an int with a constant?&lt;br&gt; 1. int foo = 123;&lt;br&gt; 2. int bar(123);&lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; What is your reaction to this line of code? delete this;&lt;br&gt; It is not a good programming Practice.&lt;br&gt; A good programmer will insist that you should absolutely never use the statement if the class is to be used by other programmers and instantiated as static, extern, or automatic objects. That much should be obvious. &lt;br&gt; The code has two built-in pitfalls. First, if it executes in a member function for an extern, static, or automatic object, the program will probably crash as soon as the delete statement executes. There is no portable way for an object to tell that it was instantiated on the heap, so the class cannot assert that its object is properly instantiated. Second, when an object commits suicide this way, the using program might not know about its demise. As far as the instantiating program is concerned, the object remains in scope and continues to exist even though the object did itself in. Subsequent dereferencing of the baller can and usually does lead to disaster. I think that the language rules should disallow the idiom, but that's another matter.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between a copy constructor and an overloaded assignment operator?&lt;br&gt; A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; When should you use multiple inheritance?&lt;br&gt; There are three acceptable answers:- &amp;quot;Never,&amp;quot; &amp;quot;Rarely,&amp;quot; and &amp;quot;When the problem domain cannot be accurately modeled any other way.&amp;quot; &lt;br&gt; Consider an Asset class, Building class, Vehicle class, and CompanyCar class. All company cars are vehicles. Some company cars are assets because the organizations own them. Others might be leased. Not all assets are vehicles. Money accounts are assets. Real estate holdings are assets. Some real estate holdings are buildings. Not all buildings are assets. Ad infinitum. When you diagram these relationships, it becomes apparent that multiple inheritance is a likely and intuitive way to model this common problem domain. The applicant should understand, however, that multiple inheritance, like a chainsaw, is a useful tool that has its perils, needs respect, and is best avoided except when nothing else will do. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is a virtual destructor?&lt;br&gt; The simple answer is that a virtual destructor is one that is declared with the virtual attribute.&lt;br&gt; The behavior of a virtual destructor is what is important. If you destroy an object through a baller or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be comple&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can a constructor throw a exception? How to handle the error when the constructor fails?&lt;br&gt; The constructor never throws a error.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are the debugging methods you use when came across a problem?&lt;br&gt; Debugging with tools like :&lt;br&gt; GDB, DBG, Forte, Visual Studio.&lt;br&gt; &lt;br&gt; Analyzing the Core dump.&lt;br&gt; &lt;br&gt; Using tusc to trace the last system call before crash.&lt;br&gt; &lt;br&gt; Putting Debug statements in the program source code.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How the compilers arranges the various sections in the executable image?&lt;br&gt; The executable had following sections:- &lt;br&gt; Data Section (uninitialized data variable section, initialized data variable section )&lt;br&gt; Code Section&lt;br&gt; Remember that all static variables are allocated in the initialized variable section.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Explain the ISA and HASA class relationships. How would you implement each in a class design?&lt;br&gt; A specialized class &amp;quot;is&amp;quot; a specialization of another class and, therefore, has the ISA relationship with the other class. &lt;br&gt; This relationship is best implemented by embedding an object of the Salary class in the Employee class. &lt;br&gt; -------------------------------------------------------------------------------&lt;br&gt; When is a template a better solution than a base class?&lt;br&gt; When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the generality) to the designer of the container or manager class. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What are the differences between a C++ struct and C++ class?&lt;br&gt; The default member and base-class access specifies are different. &lt;br&gt; This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specified and private base-class inheritance. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How do you know that your class needs a virtual destructor?&lt;br&gt; If your class has at least one virtual function, you should make a destructor for this class virtual. This will allow you to delete a dynamic object through a baller to a base class object. If the destructor is non-virtual, then wrong destructor will be invoked during deletion of the dynamic object.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between new/delete and malloc/free?&lt;br&gt; Malloc/free do not know about constructors and destructors. New and delete create and destroy objects, while malloc and free allocate and deallocate memory. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What happens when a function throws an exception that was not specified by an exception specification for this function?&lt;br&gt; Unexpected() is called, which, by default, will eventually trigger abort().&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Can you think of a situation where your program would crash without reaching the breakball, which you set at the beginning of main()?&lt;br&gt; C++ allows for dynamic initialization of global variables before main() is invoked. It is possible that initialization of global will invoke some function. If this function crashes the crash will occur before main() is entered.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What issue do auto_ptr objects address?&lt;br&gt; If you use auto_ptr objects you would not have to be concerned with heap objects not being deleted even if the exception is thrown.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Is there any problem with the following:&lt;br&gt; char *a=NULL; char&amp;amp; p = *a;?&lt;br&gt; The result is undefined. You should never do this. A reference must always refer to some object.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; Why do C++ compilers need name mangling?&lt;br&gt; Name mangling is the rule according to which C++ changes function's name into function signature before passing that function to a linker. This is how the linker differentiates between different functions with the same name. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is Polymorphism?&lt;br&gt; 'Polymorphism' is an object oriented term. Polymorphism may be defined as the ability of related objects to respond to the same message with different, but appropriate actions. In other words, polymorphism means taking more than one form. Polymorphism leads to two important aspects in Object Oriented terminology - Function Overloading and Function Overriding. Overloading is the practice of supplying more than one definition for a given function name in the same scope. The compiler is left to pick the appropriate version of the function or operator based on the arguments with which it is called. Overriding refers to the modifications made in the sub class to the inherited methods from the base class to change their behaviour.&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is Operator overloading?&lt;br&gt; When an operator is overloaded, it takes on an additional meaning relative to a certain class. But it can still retain all of its old meanings.&lt;br&gt; Examples:&lt;br&gt; 1) The operators &amp;gt;&amp;gt; and &amp;lt;&amp;lt; may be used for I/O operations because in the header, they are overloaded.&lt;br&gt; 2) In a stack class it is possible to overload the + operattor so that it appends the contents of one stack to the contents of another. But the + operator still retains its original meaning relative to other types of data. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; What is the difference between run time binding and compile time binding? &lt;br&gt; Dynamic Binding : &lt;br&gt; The address of the functions are determined at runtime rather than @ compile time. This is also known as &amp;quot;Late Binding&amp;quot;.&lt;br&gt; &lt;br&gt; Static Binding :&lt;br&gt; The address of the functions are determined at compile time rather than @ run time. This is also known as &amp;quot;Early Binding&amp;quot;&lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; When constructing an XML DTD, how do you create an external entity reference in an attribute value?&lt;br&gt; &lt;br&gt; Every interview session should have at least one trick question. Although possible when using SGML, XML DTDs don't support defining external entity references in attribute values. It's more important for the candidate to respond to this question in a logical way than than the candidate know the somewhat obscure answer. &lt;br&gt; --------------------------------------------------------------------------------&lt;br&gt; How would you build a search engine for large volumes of XML data?&lt;br&gt; The way candidates answer this question may provide insight into their view of XML data. For those who view XML primarily as a way to denote structure for text files, a common answer is to build a full-text search and handle the data similarly to the way Internet portals handle HTML pages. Others consider XML as a standard way of transferring structured data between disparate systems. These candidates often describe some scheme of importing XML into a relational or object database and relying on the database's engine for searching. Lastly, candidates that have worked with vendors specializing in this area often say that the best way the handle this situation is to use a third party software package optimized for XML data.&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p class=MsoNormal style='line-height:19.2pt'&gt;&lt;font size=2 color=black face=Arial&gt;&lt;span lang=EN style='font-size:10.0pt;font-family:Arial;color:black'&gt;&amp;nbsp;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112623889319525190?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112623889319525190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112623889319525190&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112623889319525190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112623889319525190'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/general-java-interview-questions-core.html' title=''/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112677284101144055</id><published>2005-09-06T13:15:00.000-07:00</published><updated>2005-09-15T01:27:21.746-07:00</updated><title type='text'>Types of Drivers continued...</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Introduction to 3 tier Architecture:&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;2 tier application – client/server&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;3 tier application – application using 3 tiers&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;In a 2 tired application the client/front-end is responsible for displaying the user interface, taking the inputs from the user and talking to the backend. The server is responsible for storing the data, manipulating the data and giving the data to front end as per the request of the client.&lt;br /&gt;&lt;br /&gt;In every business application there will be user interface logic and business logic. User interface code is responsible for setting up the UI and allowing the user to interact with the application. Business logic is the code that implements business procedures.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/5338/1183/320/driver3.gif" border="0" /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;There are 2 approaches to develop 2-tiered applications,&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;DB will be used to store the data, the UI logic and the business logic will be implemented in the front end.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Only UI and the code that executes stored procedures will be written in the client and the business logic will be implemented in the DB server as a  stored procedure. This approach is adopted by most of the companies because of,&lt;br /&gt;1.       Increasing the performance&lt;br /&gt;2.        Ease of maintenance &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;We can maintain the application easily if the business logic is separated from UI. These applications are not scalable i.e. these are applicable effectively with less number of clients. If the number of clients increases the response time&lt;br /&gt;increase i.e. decreases performance.To take care of scalability most of the companies has started 3-n-multi tired&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;If the number of the clients increases addition of I more server to decrease the burden at middle tier.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;3 Tier Architecture&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/5338/1183/1600/driver4.gif"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/5338/1183/320/driver4.gif" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;We can develop a business application using the above architecture. The application server like Web logic, Web sphere, I-planet, sun one studio, jboss … can be used in the middle tier to implement business logic. This will be interacting with DB, existing Enterprise Information Systems (EIS).&lt;br /&gt;&lt;br /&gt;For integrating different applications we can use wide variety of techniques. Most of the developers prefer to use XML for exchanging the data, web services, JMS, EJB and Java Connector architecture.&lt;br /&gt;&lt;br /&gt;If we write a program as multiple pieces and deploy them on multiple machines, we can reduce the load on a single machine. To do this we need to write lot of networking code apart from the business logic and user interface. We can make use of the distributed technologies RPC, CORBA, RMI and DCOM to reduce the code we have to develop. With these technologies the network code will be generated automatically and developers using these technologies can concentrate on writing business logic and UI. The implementation of above technologies provides the tools like rmic for RMI, idltojava, idltoc++ … for CORBA and MIDL compiler for DCOM. &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112677284101144055?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112677284101144055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112677284101144055&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677284101144055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677284101144055'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/types-of-drivers-continued_06.html' title='Types of Drivers continued...'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112677206290890071</id><published>2005-09-04T01:12:00.000-07:00</published><updated>2005-09-15T01:14:22.910-07:00</updated><title type='text'>Types of Drivers continued...</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;These are the different ways in which the driver can be implemented.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Prepared statements: “select statements”&lt;br /&gt;&lt;/strong&gt;Don’t use parameters in place of table names and column names we will get errors like “Invalid table name” and “Invalid no”.We have to use stmt.executeQuery() in System.out.println()&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Update statements:&lt;br /&gt;&lt;/strong&gt;PreparedStatement stmt = con.PreparedStatement(“update emp set col1=?where cal2 =?”);&lt;br /&gt;We have to use stmt.executeUpdate() in System.out.println().&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Updatable Resultset:&lt;br /&gt;&lt;/strong&gt;We can read and update a row from a table ex:,&lt;br /&gt;Connection con;&lt;br /&gt;con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:&lt;br /&gt;1521:orcl","scott","tiger");&lt;br /&gt;Statement stmt = con.createStatement(&lt;br /&gt;ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);&lt;br /&gt;ResultSet rs = stmt.executeQuery("select eno, ename, deptno from Emp");&lt;br /&gt;rs.moveToInsertRow(); // creating the memory&lt;br /&gt;rs.updateInt(1,1001);&lt;br /&gt;rs.updateString(2,”xyz”); // filling the memory&lt;br /&gt;rs.updateInt(3,10);&lt;br /&gt;rs.insertRow(); // insert a row write the above values.&lt;br /&gt;rs.close()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If in we CONCUR_UPDATABLE we can update the values and if we use CONCUR_READ_ONLY we can’t update the values.CONCUR_UPDATABLE is automated. Here it is internally using two SQL queries instead of single query by manually so it’s better to go manually instead of automated. It will improve the performance.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Stored Procedure&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;Most of the DB vendors support stored procedure that can be implemented directly in the DB.Ex: (1) In Oracle we can use PL/SQL as well as java language to implement stored procedures.(2) In SQL server we can use TSQL&lt;br /&gt;&lt;br /&gt;Using JDBC the java programs can execute stored procedures stored in the DB irrespective of the language in which the stored procedure is created.&lt;br /&gt;To call a stored procedure java programmers need to know the name of procedure, input parameters and output parameters.&lt;br /&gt;&lt;br /&gt;To call a procedure we need to create CallableStatement using&lt;br /&gt;CallableStatement stmt=con.prepareCall(“begin proc0;end;”) //oracle&lt;br /&gt;CallableStatement stmt=con.prepareCall(“{call pro0}”) // any DB&lt;br /&gt;&lt;br /&gt;To call a stored procedure:&lt;br /&gt;&lt;br /&gt;·          Create a callable statement&lt;br /&gt;·          Set the input parameters&lt;br /&gt;·          Register the data types of output param&lt;br /&gt;·          Execute the procedure&lt;br /&gt;·          Read the output values&lt;br /&gt;Ex:&lt;br /&gt;&lt;br /&gt;CallableStatement stmt = con.prepareCall("{ call proc1 (?,?,?) }");&lt;br /&gt;int inparam=1;&lt;br /&gt;int inoutparam=33;&lt;br /&gt;//set input parameters&lt;br /&gt;stmt.setInt(1,inparam);&lt;br /&gt;stmt.setInt(3,inoutparam);&lt;br /&gt;//register output types&lt;br /&gt;stmt.registerOutParameter(2,Types.INTEGER);&lt;br /&gt;stmt.registerOutParameter(3,Types.INTEGER);&lt;br /&gt;stmt.execute();&lt;br /&gt;SQLWarning sqlw = stmt.getWarnings();&lt;br /&gt;System.out.println(sqlw);&lt;br /&gt;System.out.println(" output param ="+ stmt.getInt(2)+" inout&lt;br /&gt;parameter = " + stmt.getInt(3));&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-size:100%;"&gt;Functions&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;In case of Oracle we can write the functions. A function can take input parameter and it can return a value. Default mode is IN.&lt;br /&gt;&lt;br /&gt;To call a function the callable statement has to be created using the syntax given below CallableStatement stmt = con.prepareCall(“{?=call fun0(?)}”);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112677206290890071?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112677206290890071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112677206290890071&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677206290890071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677206290890071'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/types-of-drivers-continued_04.html' title='Types of Drivers continued...'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112677189810524303</id><published>2005-09-02T13:05:00.000-07:00</published><updated>2005-09-15T01:11:38.110-07:00</updated><title type='text'>Types of Drivers continued...</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;JavaSoft has implemented Type1 i.e. JDBC-ODBC bridge.&lt;br /&gt;&lt;em&gt;URL: JDBC:ODBC:acc1&lt;br /&gt;standard data source name (DNS)&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;When we use Type1 drivers we need to configure ODBC DNS as, Start Settings Control Panel Administrative Tools  Data Sources (ODBC) à  System DSNà   Add   Microsoft Access Driver (*.mdb)  àfinish à  select directory -- Name it that select from where you have data.&lt;br /&gt;&lt;br /&gt;We can access the data available in the files using appropriate driver.&lt;br /&gt;&lt;br /&gt;To execute data manipulation statements using executeUpdate. The return value of it is an int indicating the number of rows effected.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;int nr = stmt.executeUpdate(“insert into abc.txt values (‘a’’b’’c’)”);&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;In case of DB like Quad base we can group a set of DB objects like Tables,views and store them in a schema (set of objects). In case of Oracle we place the objects under a username i.e. username itself called as a schema in Oracle.&lt;br /&gt;&lt;br /&gt;In case of Quad base we will establish the connection with the server by connecting with a specific schema. As part of executeUpdate we can use any valid SQL statements. Ex: drop table, create table, create user, drop user.&lt;br /&gt;&lt;br /&gt;Every DB server stores the Metadata in a set of standard tables. Ex: if you define a table the server will be storing the name of the table, the columns of the table and data types of the columns.&lt;br /&gt;&lt;br /&gt;From our JDBC program we can get the metadata info using ResultSetMetadata object &lt;em&gt; (java.sql.ResultSetMetadata.getMetaData)&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;Different DB vendors support different data types ex: SQL server supports BIT, SMALLINT, BIGINT, FLOAT, DATE, TIME, and TIMESTAMP etc… where as Oracle supports number, char, varchar, date …&lt;br /&gt;&lt;br /&gt;You can find different types of SQL data types &lt;/span&gt;&lt;a href="http://www.idevelopment.info/data/Programming/java/jdbc/SQL_Datatypes"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;http://www.idevelopment.info/data/Programming/java/jdbc/SQL_Datatypes&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;_and_Java_Datatypes.html&lt;br /&gt;&lt;br /&gt;There is as standard called SQL standard – defines the syntax of SQL and the data types that has to be supported by a DB server. A DB vendor need not support all the data types of SQL standard directly. In JDBC java.sql.Types class provides a list of constants representing different SQL data types.&lt;br /&gt;&lt;br /&gt;Metadata not only deals with data but also deals with drivers and versions.DB Metadata can be used to get the info about the JDBC driver we are using and the DB we are accessing. Difference between executeQuery and executeUpdate:&lt;br /&gt;&lt;em&gt;executeQuery returns ResultSet type where as executeQuery returns int type.&lt;br /&gt;&lt;/em&gt;&lt;br /&gt;How JDBC manages Transactions:&lt;br /&gt;Whenever we start the operation the transaction is automatically started in case of JDBC. Once the transaction is committed/rollback the next transaction is automatically started. In most of the DB applications being performed multiple operations on the DB in a single transaction by default. The JDBC drivers using Auto Commit Mode in this mode the driver issues the commit statement after we execute a SQL statement.&lt;br /&gt;&lt;br /&gt;As most of the applications updates multiple tables as part of as single transaction we must not use Auto Commit Mode. For this we can use Connection.setAutoCommit(false); The transactions will not be committed automatically. Connecton.commit() makes the transaction committed permanently.&lt;br /&gt;&lt;br /&gt;We can perform multiple operations in a transaction and commit/rollback the transaction using Connection.commit() and Connection.rollback(). For our java program when we execute stmt.executeUpdate() or stmt.executeQuery internally the server performs (a) parse the statement and (b) execute the statement.&lt;br /&gt;&lt;br /&gt;In most of the applications we issue the statements like,&lt;br /&gt;&lt;em&gt;insert into tab1 values(1,2);&lt;br /&gt;insert into tab1 values(2,3);&lt;br /&gt;insert into tab1 values(3,4); &lt;/em&gt;repeatedly with a different set of values.&lt;br /&gt;If we are use the statement objects to execute such a set of statements, the statements has be parsed every time. We can reduce this by making use of PreparedStatement.&lt;br /&gt;&lt;br /&gt;For using PreparedStatement we need to follow the steps,&lt;br /&gt;·          Create a prepared statement using, PreparedStatement stmt = con.prepareStatement();&lt;br /&gt;·          Set the parameters [replace values (1,1) as values(?,?)]&lt;br /&gt;·          Execute the statement&lt;br /&gt;Ex: PreparedStatement stmt = con.prepareStatement(“insert into tab1&lt;br /&gt;values(?,?));&lt;br /&gt;stmt.setInt(1,100);&lt;br /&gt;stmt.setInt(2,100);&lt;br /&gt;System.out.prinln(“No of rows effected = “ +stmt.executeUpdate());&lt;br /&gt;&lt;br /&gt;Parameters are called as bind variables in Oracle and defined with (:1,:2) We will use executeUpdate() for insert, update or drop operations and executeQuery() for select operation. URL depends upon the JDBC driver we are using.&lt;br /&gt;To perform the DB operations we can use,&lt;br /&gt;·         Statement object&lt;br /&gt;·         PreparedStatement object&lt;br /&gt;·         CallableStatement object&lt;br /&gt;&lt;br /&gt;To execute a select statement we can use Statement.executeUpdate If the statement is executed successfully it will return an object of type ResultSet. From the ResultSet we can access the data retrieved by the query. From ResultSet we can access one row at a time, it internally maintains a pointer to the current row. ResultSet.next() advances the current row pointer by one row and returns a true value if it points to a real row and a false value when it points to after last row.&lt;br /&gt;&lt;br /&gt;There are imaginary rows with the real rows. They are (a) before first row (b) after last row. To get the column values of current row we can use ResultSet.getxxx(column- no or column-name); where xxx stands for String,int, float … This statement will fail when the current row points to imaginary rows.&lt;br /&gt;&lt;br /&gt;In getxxx functions we can either pass the column-no or the column-name.Depending upon the column data type we need to choose appropriate getter like &lt;em&gt;getString, getInt&lt;/em&gt;. Most of the JDBC drivers support unidirectional ResultSets as well as bidirectional ResultSets. By default unidirectional ResultSet will be created.If we use a bidirectional ResultSet we can use the methods like previous,first, last, absolute …&lt;br /&gt;&lt;br /&gt;To create a ResultSet that allows us to move forward and backward we have to create a statement object using,&lt;br /&gt;&lt;em&gt;Statement stmt = Connection.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;By using ResultSet.absolute(10) we will directly go to 10th row.Unidirectional result set are known as forward only resultset and bidirectional result sets are known as scrollable result sets. In scrollable result sets we have scroll sensitive and scroll insensitive result sets. Theoretically scrollable sensitive result sets are sensitive to changes and scrollable insensitive result sets are not sensitive to changes. But practically these are not implemented by the vendors. In JavaSoft documentation it is specified that sensitive resultsets are generally sensitive to changes.&lt;br /&gt;&lt;br /&gt;The constant can be used to specify that we will read the values from the result set. The constant is ResultSet.CONCUR_READ_ONLY (concurrent read only). A resultset can be opened for updation also. For this we need to use the constant. ResultSet.CONCUR_UPDATABLE. We can develop our programs without using the features like CONCUR_UPDATABLE, SCROLL_SENSITIVE. Not every driver available in the market supports scrollable and updatable resultsets.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112677189810524303?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112677189810524303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112677189810524303&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677189810524303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677189810524303'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/types-of-drivers-continued.html' title='Types of Drivers continued...'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112563853096739898</id><published>2005-09-01T22:21:00.000-07:00</published><updated>2005-09-01T22:31:40.016-07:00</updated><title type='text'>Java Interview Questions On JDBC</title><content type='html'>&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;Is the JDBC-ODBC Bridge multi-threaded?&lt;/strong&gt; - No. The JDBC-ODBC Bridge does not support concurrent access from different threads. The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won’t get the advantages of multi-threading. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?&lt;/strong&gt; - No. You can open only one Statement object per connection when you are using the JDBC-ODBC Bridge. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What is cold backup, hot backup, warm backup recovery?&lt;/strong&gt; - Cold backup (All these files must be backed up at the same time, before the databaseis restarted). Hot backup (official name is ‘online backup’) is a backup taken of each tablespace while the database is running and is being accessed by the users. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;When we will Denormalize data? &lt;/strong&gt;- Data denormalization is reverse procedure, carried out purely for reasons of improving performance. It maybe efficient for a high-throughput system to replicate data for certain data. What is the advantage of using PreparedStatement? - If we are using PreparedStatement the execution time will be less. The PreparedStatement object contains not just an SQL statement, but the SQL statement that has been precompiled. This means that when the PreparedStatement is executed,the RDBMS can just run the PreparedStatement’s Sql statement without having to compile it first. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What is a “dirty read”?&lt;/strong&gt; - Quite often in database processing, we come across the situation wherein one transaction can change a value, and a second transaction can read this value before the original change has been committed or rolled back. This is known as a dirty read scenario because there is always the possibility that the first transaction may rollback the change, resulting in the second transaction having read an invalid value. While you can easily command a database to disallow dirty reads, this usually degrades the performance of your application due to the increased locking overhead. Disallowing dirty reads also leads to decreased system concurrency. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What is Metadata and why should I use it?&lt;/strong&gt; - Metadata (’data about data’) is information about one of two things: Database information (java.sql.DatabaseMetaData), or Information about a specific ResultSet (java.sql.ResultSetMetaData). Use DatabaseMetaData to find information about your database, such as its capabilities and structure. Use ResultSetMetaData to find information about the results of an SQL query, such as size and types of columns. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;Different types of Transaction Isolation Levels? &lt;/strong&gt;- The isolation level describes the degree to which the data being updated is visible to other transactions. This is important when two transactions are trying to read the same row of a table. Imagine two transactions: A and B. Here three types of inconsistencies can occur:&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;***Dirty-read: A has changed a row, but has not committed the changes. B reads the uncommitted data but his view of the data may be wrong if A rolls back his changes and updates his own changes to the database.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;***Non-repeatable read: B performs a read, but A modifies or deletes that data later. If B reads the same row again, he will get different data. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;***Phantoms: A does a query on a set of rows to perform an operation. B modifies the table such that a query of A would have given a different result. The table may be inconsistent. TRANSACTION_READ_UNCOMMITTED : DIRTY READS, NON-REPEATABLE READ AND PHANTOMS CAN OCCUR. TRANSACTION_READ_COMMITTED : DIRTY READS ARE PREVENTED, NON-REPEATABLE READ AND PHANTOMS CAN OCCUR. TRANSACTION_REPEATABLE_READ : DIRTY READS , NON-REPEATABLE READ ARE PREVENTED AND PHANTOMS CAN OCCUR. TRANSACTION_SERIALIZABLE : DIRTY READS, NON-REPEATABLE READ AND PHANTOMS ARE PREVENTED.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What is 2 phase commit? &lt;/strong&gt;- A 2-phase commit is an algorithm used to ensure the integrity of a committing transaction. In Phase 1, the transaction coordinator contacts potential participants in the transaction. The participants all agree to make the results of the transaction permanent but do not do so immediately. The participants log information to disk to ensure they can complete In phase 2 f all the participants agree to commit, the coordinator logs that agreement and the outcome is decided. The recording of this agreement in the log ends in Phase 2, the coordinator informs each participant of the decision, and they permanently update their resources. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;How do you handle your own transaction ? &lt;/strong&gt;- Connection Object has a method called setAutocommit(Boolean istrue) - Default is true. Set the Parameter to false , and begin your transaction. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What is the normal procedure followed by a java client to access the db?&lt;/strong&gt; - The database connection is created in 3 steps: &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;a. Find a proper database URL &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;b. Load the database driver &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;c. Ask the Java DriverManager class to open a connection to your databaseIn java code, the steps are realized in code as follows: &lt;strong&gt;i. &lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Create a properly formatted JDBR URL for your database. &lt;strong&gt;ii.&lt;/strong&gt; A JDBC URL has the form jdbc:someSubProtocol://myDatabaseServer/theDatabaseName. &lt;strong&gt;iii.&lt;/strong&gt; Class.forName(”my.database.driver”); &lt;strong&gt;iv. &lt;/strong&gt;Connection conn = DriverManager.getConnection(”a.JDBC.URL”, “databaseLogin”,”databasePassword”);&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What is a data source? &lt;/strong&gt;- A DataSource class brings another level of abstraction than directly using a connection object. Data source can be referenced by JNDI. Data Source may point to RDBMS, file System , any DBMS etc. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;What are collection pools? What are the advantages? &lt;/strong&gt;- A connection pool is a cache of database connections that is maintained in memory, so that the connections may be reused. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;strong&gt;How do you get Column names only for a table (SQL Server)?&lt;/strong&gt; Write the Query. - select name from syscolumns where id=(select id from sysobjects where name='user_hdr') order by colid --user_hdr is the table name.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112563853096739898?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112563853096739898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112563853096739898&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112563853096739898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112563853096739898'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/java-interview-questions-on-jdbc.html' title='Java Interview Questions On JDBC'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112563847083750689</id><published>2005-09-01T10:13:00.000-07:00</published><updated>2005-09-01T22:21:10.840-07:00</updated><title type='text'>JDBC continued...</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;We can also use WinZip to open jar files. We can use .zip extension. In JDK 1.0 (old versions) the class files are packaged in .zip files but the preferred extension now is .jar. We can extract a jar file using,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;em&gt;C:\dir1&amp;gt; java xvf myclass.jarx&lt;/em&gt; – extract v – verbose form f – file.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;To ser class path for jar files, &lt;em&gt;set classpath = c:\dir1\myclass.jar&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;For more info on jar see the link, &lt;/span&gt;&lt;a href="http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jar.html"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jar.html&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;In JDBC programs we need to· &lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Register the driver&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Connect to DB&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Perform the DB operations using SQL statements like &lt;em&gt;insert&lt;/em&gt;, &lt;em&gt;update&lt;/em&gt;, &lt;em&gt;delete&lt;/em&gt;, &lt;em&gt;select&lt;/em&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Disconnect&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;To register a driver we need to know the name of the class that provides the implementation of &lt;em&gt;java.sql.Driver&lt;/em&gt;.&lt;/span&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;We can use class.forName followed by the name of the driver class as, &lt;em&gt;class.forName(“oracle.jdbc.driver.oracledriver”)&lt;/em&gt;;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;We can use the code, &lt;em&gt;java.sql.DriverManager.registerDriver(neworacle.jdbc.driver.OracleDriver())&lt;/em&gt;;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Instead of writing the code to register the driver we can set the system property &lt;em&gt;jdbc.drivers&lt;/em&gt; on the command line as, java –D jdbc.drivers=oracle.jdbc.driver.OracleDriver syntax: &lt;em&gt;java –D&amp;lt;name&amp;gt;=&amp;lt;value&amp;gt&lt;/em&gt;;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;According to our requirement we can define our own system properties.JavaSoft has defined some standard system properties. We can get the info like the name of the Operating System, JVM’s version … using standard system properties.The system properties can also be set inside Users Home Directory (~) ~/.hotjava/properties file On windows operating sys Home directories are created under “Documents and Settings”.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;We can never create an object based on an interface.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;Connection, Statement and ResultSet are interfaces. They are properly implemented by its vendors. Here the creating objects are because of the interfaces are implemented as classes by vendors. The objects are of these classes. In the code we are not creating objects by interface because we cannot create objects by interface.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112563847083750689?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112563847083750689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112563847083750689&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112563847083750689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112563847083750689'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/jdbc-continued.html' title='JDBC continued...'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112677111017574175</id><published>2005-09-01T00:47:00.000-07:00</published><updated>2005-09-15T00:58:30.183-07:00</updated><title type='text'>Types of Drivers</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;We have four types of drivers: &lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Type1 &lt;/strong&gt;or JDBC-ODBC Bridge &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Type2 &lt;/strong&gt;or native-API partly Java technology-enabled driver &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Type3&lt;/strong&gt; or net-protocol fully Java technology-enabled driver &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Type4&lt;/strong&gt; or native-protocol fully Java technology-enabled driver ( thin driver) &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/5338/1183/320/driver1.gif" border="0" /&gt;&lt;br /&gt;Problem with Type1 and Type2 drivers is we need to use additional software like DB specific client and ODBC driver software apart from java classes.&lt;br /&gt;&lt;br /&gt;Type3 and Type4 drivers are implemented in Java.&lt;br /&gt;&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://photos1.blogger.com/blogger/5338/1183/320/driver2.gif" border="0" /&gt;Native API of Oracle is OCI. Incase of Type3 and Type4 we need not install additional softwares on the client machines but incase of Type3 on one of&lt;br /&gt;the machine we need to install netserver.&lt;br /&gt;&lt;br /&gt;Oracle corp. has provided both Type2 (OCI) and Type4 (Thin) as part of the same set of classes (classesxx.zip).&lt;br /&gt;&lt;br /&gt;If Type3, Type4, Type2 are not available then we can make use of Type1 driver supplied by JavaSoft or any other vendors.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112677111017574175?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112677111017574175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112677111017574175&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677111017574175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112677111017574175'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/09/types-of-drivers_01.html' title='Types of Drivers'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112563801547590742</id><published>2005-08-31T22:07:00.000-07:00</published><updated>2005-09-15T21:25:16.783-07:00</updated><title type='text'>JDBC continued...</title><content type='html'>&lt;span style="font-family:arial;"&gt;Microsoft has released a specification called ODBC API with the functions like SQLconnect, SQLexecute, SQLfetch …. This specification gives the info about the purpose of each and every function, parameters to the functions, the expected return values of the function. This info can be used by any vendor to provide the implementation. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Anyone can provide the implementation of ODBC API functions. These implementations are called as ODBC Drivers.&lt;br /&gt;ODBC drivers are supplied as Dynamic Link Libraries (DLL). For a single DB there can be multiple ODBC drivers. With the ODBC option the programmers need not learn the Native APIs. Once he learns the ODBC functions he can write the code to interact with any DB using the same set of functions. To run the programs that use ODBC API requires the appropriate ODBC driver.Programs using Native APIs are much more efficient than programs using ODBC API.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;JDBC is an open API that can be implemented by anyone similar to ODBC API implementations. As part of JDBC specification JavaSoft has provided a set of interfaces like java.sql.Driver, &lt;em&gt;java.sql.Connection, java.sql.CallableStatement, java.sql.ResultSet, java.sql.Blob, java.sql.Statement, java.sql.PrepareStatement, java.sql.Clob&lt;/em&gt; plus the classes like &lt;em&gt;java.sql.DriverManager, java.sql.Date, java.sql.Time&lt;/em&gt; ...&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Any vendor can provide the implementation of these interfaces. The implemented classes are called as JDBC drivers. Every vendor provides the documentation in which he specifies the name of the class that provides the implementation of java.sql.Driver. In the documentations provided by the vendors they will specify the JDBC URL.&lt;br /&gt;To write the JDBC program:&lt;br /&gt;• .zip or .jar containing JDBC drivers&lt;br /&gt;• Name of Driver class&lt;br /&gt;• JDBC URL&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;DriverManager class is responsible for maintaining the info about the drivers loaded by a program. Class path: when we compile the source code the java compiler searches for the classes in the source in class path. It is very common to place the class files under different directories. In this case we need to specify all the directories as part of the class path.&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;em&gt;javac -classpath c:\dir1\dir2 one.java&lt;/em&gt;&lt;br /&gt;&lt;em&gt;javac -classpath c:\dir1\dir2;d:\dir1 one.java&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;As part of class path we can specify multiple directories separated by ‘&lt;strong&gt;;&lt;/strong&gt;’. The above command can be replaced by, &lt;em&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;em&gt;set classpath = c:\dir1\dir2;d:\dir1&lt;br /&gt;javac one.java&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Instead of using –classpath option with javac and java commands we directly set the classpath environment variable using the set command as shown above. To view the value of classpath environment variable we can use,&lt;br /&gt;&lt;em&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;em&gt;echo %classpath%&lt;br /&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;It is very common to use jar files to combine multiple classes. We can create jar file as,&lt;br /&gt;&lt;em&gt;c:\dir1&amp;gt; java cvf myclass.jar .&lt;br /&gt;&lt;/em&gt;c – create a jar file&lt;br /&gt;v – verbose form&lt;br /&gt;f – file name&lt;br /&gt;. is used to represent current dir&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Above command takes the files from the current directory and places them in myclass.jar. To view the jar file,&lt;br /&gt;&lt;em&gt;C:\dir1&amp;gt; java tvf myclass.jar&lt;br /&gt;&lt;/em&gt;t – table of contents&lt;br /&gt;v - verbose form&lt;br /&gt;f – file name.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112563801547590742?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112563801547590742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112563801547590742&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112563801547590742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112563801547590742'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/08/jdbc-continued.html' title='JDBC continued...'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112537480317585006</id><published>2005-08-29T21:06:00.000-07:00</published><updated>2005-09-01T22:06:35.943-07:00</updated><title type='text'>JDBC (Java Data Base Connectivity)</title><content type='html'>&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;For a C programmer an API is a set of functions ex: Windows API is supplied by Microsoft which consists of a set of functions that can be used to &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;write windows applications. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Ex: A company xyz may supply a product like xyz printer API. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;For accessing the Data Bases like Oracle, Sybase, and Informix from a C language we can use DB specific APIs (Native APIs). &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Almost all DB server vendors provide server and client components. Server component is responsible for managing the DB and client component is &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;responsible for connecting to server and perform different DB operations.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;As part of the client software most of the DB vendors provide the tools which can be used by the developers and the administrators plus a set of &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;libraries those can be used as part of the project. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;If we have to use Oracle server from the C programs we can use Oracle Call Interface (OCI) i.e. supplied by Oracle corp.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Incase of Oracle we get OCI when we install Oracle client. Similarly Sybase provides Sybase DB Lib and Microsoft provides DB &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Library to access SQL server. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;We can develop the C program to access Oracle using OCI calls.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;In almost all DB operations we follow&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;• Connect to DB&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;• Perform DB operation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;• Disconnect&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;If native APIs are used we may need to write lot of code for supporting different Data Bases and the developer need to learn about multiple APIs. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;To simplify writing the programs that access DB Xopen.org specified Client Level Interface (CLI) and Microsoft has specified ODBC. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;An open specification is a specification that is available for public (anyone can use the specification).&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;There are so many companies which has released the specifications about an API or a technology. If the specification is available for all anyone can &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;provide the implementation. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Specification means no code only prototype Implementation means providing the code. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;Once the specification is released multiple vendors can provide the implementations this gives wide choice to the customers in choosing the &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;product.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112537480317585006?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112537480317585006/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112537480317585006&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112537480317585006'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112537480317585006'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/08/jdbc-java-data-base-connectivity.html' title='JDBC (Java Data Base Connectivity)'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15825877.post-112506531290249255</id><published>2005-08-26T07:06:00.000-07:00</published><updated>2005-09-15T21:29:27.353-07:00</updated><title type='text'>Get Master In Java</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;java can be used by the programmers to find the info about a java class. It can also be used to disassemble the code that should in a class file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Ex: javap &lt;options&gt;&lt;classes&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;javap java.lang.Integer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;When we compile a java class file, the java compiler generates a class file inbyte code (numbers representing instructions). When javap tool is executedwith -c option these numbers will be converted as instructions like getstatic,return.As part of the Object class we have an implementation of toString(),hashCode() methods. Depending upon our requirement we may need toprovide the implementation of these methods.The implementation of hashCode provided by Java Soft may not be suitablefor our classes. In this case we need to implement our own logic for hashCode. The objects representing the same information must return the same hashcode.Apart from implementing hashCode we need to implement equals() –returns true if your objects are considered to be equal.&lt;br /&gt;Even though equals was implemented as part of object class this may notsatisfy our requirements. In such a case we need to override equals().*We have to override equals() whenever hashCode() is overridden.toString() provided as part of object class returns the name of the class andthe hashcode. This may not be that useful in debugging the code.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;toString()&lt;br /&gt;hashCode() Used for debuggingequals()&lt;br /&gt;&lt;br /&gt;Most of the programmers debug their applications by including thestatements that displays the information about the object. It is alwaysadvisable to provide toString() that returns the info about the object.Its our responsibility to return useful info from toString() method.Used to identify whether theobjects are same or not&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Software Development Kit (SDK):&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;So many companies have released the products that can be used by thesoftware developers to develop programs. These products are generallyreferred as SDK ex: Microsoft Windows SDK which contains imagecontrols, cursor controls, text editor, c compiler, linker, debugger, headerfiles and libraries used to develop programs in windows.Java soft has provided a set of tools like javac, javap, appletviewer, javadoc,rmic, jdb, jar, idlj … to help programmers in developing the javaapplications. These set of tools are packaged together as Java DevelopmentKit (JDK).&lt;br /&gt;Most of the UNIX programmers place their executables (binaries) under Bindirectory, libraries under Lib directory and header files under Includedirectory.Instead of supporting the class files to a customer separately we can packthem as a single file using java archiver (JAR2 – Java Archive 2). Jar usesthe format which is same as the format used by WinZip.&lt;br /&gt;&lt;br /&gt;Native code is the code implemented in a language other than java (c, c++).For including native code some header files has to include.As part of JDK JavaSoft has supplied Java Runtime Environment (JRE)which will be available under JRE directory. JRE is the set of tools, libraries that are required to run java applications.JavaSoft for windows has supplied java.exe which is JVM (Java VirtualMachine). Apart from JavaSoft the companies like JRockit, TowerJ,Blackdown supplies JVM of their own.JRockit, TowerJ are commercial products and they are considered to be very efficient than the JVM supplied by Sun Microsystems.MFC is a set of classes used by c++ programmers to develop windows application.JavaSoft has developed the extensions like Swing (code name for JFC),servlets with the package name like javax.swing, javax.servlet.&lt;br /&gt;&lt;br /&gt;From Java 1.2 JavaSoft has started using the new term called Java 2Platform.&lt;br /&gt;Later on JavaSoft has released 3 different packages.• J2SE used to develop the client applications• J2EE used to develop the server side applications• J2ME used to develop java applications that run inside small deviceslike Mobile phones …Difference is on the set of packages available in each.For a java programs an API (Application Program Interface) is a set of interfaces and classes.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15825877-112506531290249255?l=master-in-java.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://master-in-java.blogspot.com/feeds/112506531290249255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15825877&amp;postID=112506531290249255&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112506531290249255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15825877/posts/default/112506531290249255'/><link rel='alternate' type='text/html' href='http://master-in-java.blogspot.com/2005/08/get-master-in-java.html' title='Get Master In Java'/><author><name>Dipali</name><uri>http://www.blogger.com/profile/11006959803848306145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
