<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ankit Virparia &#187; Sonali Virparia</title>
	<atom:link href="http://ankit.co/author/sonali/feed" rel="self" type="application/rss+xml" />
	<link>http://ankit.co</link>
	<description>A Programmer, Designer and Trainer</description>
	<lastBuildDate>Sun, 11 May 2014 04:15:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>Introduction to Stream</title>
		<link>http://ankit.co/tutorials/java-tutorials/input-output/introduction-to-stream?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introduction-to-stream</link>
		<comments>http://ankit.co/tutorials/java-tutorials/input-output/introduction-to-stream#comments</comments>
		<pubDate>Sun, 13 Jan 2013 18:18:01 +0000</pubDate>
		<dc:creator><![CDATA[Sonali Virparia]]></dc:creator>
				<category><![CDATA[Input Output]]></category>

		<guid isPermaLink="false">http://ankit.co/?p=500</guid>
		<description><![CDATA[<p>What is a stream? Before we come to the actual definition of stream let us first consider an example in terms of operating system. We can have multiple applications running on our system. In order to identify each application an OS makes use of port numbers. When we send some data from one port to [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/java-tutorials/input-output/introduction-to-stream">Introduction to Stream</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h3>What is a stream?</h3>
<p>Before we come to the actual definition of stream let us first consider an example in terms of operating system. We can have multiple applications running on our system. In order to identify each application an OS makes use of port numbers. When we send some data from one port to another then we are forming a stream between the two. So stream here is the direction or we can also say a combination of source port and destination port.</p>
<p>Consider an example: suppose we want to execute a java application. To do that we first start command prompt. So the OS assigns some port number P1 to it. Now to compile our java application we use javac.exe which is the compiler for java and OS assigns port number say P2 to it. But compiling is a small process so it will finish early. Once the application is compiled we launch our application using java interpreter i.e. java.exe. OS assigns it a port number say P3. According to the feature of JRE, it creates two static objects: in and out, identifying the direction from P1 to P3 and from P3 to P1 respectively. Both these objects have been declared in java.lang.System class. </p>
<p>Therefore whenever we want to take some input into our application we have to specify the direction using <strong>System.in</strong> and when we want to send some output from our application we have to specify its direction using <strong>System.out</strong>. There are mainly two streams in java: <strong>byte stream</strong> and <strong>character stream</strong>. Detailed discussion on both the streams would be done in next tutorial. </p>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/java-tutorials/input-output/introduction-to-stream">Introduction to Stream</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankit.co/tutorials/java-tutorials/input-output/introduction-to-stream/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What is an Applet?</title>
		<link>http://ankit.co/tutorials/java-tutorials/applet/what-is-an-applet?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=what-is-an-applet</link>
		<comments>http://ankit.co/tutorials/java-tutorials/applet/what-is-an-applet#comments</comments>
		<pubDate>Thu, 03 Jan 2013 17:38:25 +0000</pubDate>
		<dc:creator><![CDATA[Sonali Virparia]]></dc:creator>
				<category><![CDATA[Applet]]></category>
		<category><![CDATA[What is]]></category>

		<guid isPermaLink="false">http://ankit.co/?p=83</guid>
		<description><![CDATA[<p>An applet is a small and portable application that runs under the restricted scope provided by JRE. It has dual compatibility as it can be executed on a web browser and also by applet viewer. JVM is required on the client machine to run an applet program. Five steps to be kept in mind when [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/java-tutorials/applet/what-is-an-applet">What is an Applet?</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>An applet is a small and portable application that runs under the restricted scope provided by JRE. It has dual compatibility as it can be executed on a web browser and also by applet viewer. JVM is required on the client machine to run an applet program.</p>
<p><strong>Five steps to be kept in mind when writing an applet program:</strong></p>
<p>1. import java.applet.*  (Need Applet class from java.applet package)</p>
<p>2. create a public class (Class name and File name must be same in case of public class)</p>
<p>3. extend the class from the base class Applet </p>
<p>4. do not write main method </p>
<p>5. write the applet life cycle methods (i.e.  init, start, stop, destroy, paint)</p>
<p><strong>File name:</strong> abc.java</p>
<pre class="brush: java; title: ; notranslate">
import java.applet.*;

public class abc extends Applet
{
}
</pre>
<p><strong>Steps to compile and Run Applet program:</strong></p>
<ol>
<li>Compile your java code using javac.exe on console/command prompt.</li>
<li>To run the generated class file, we have to write &lt;applet&gt; tag in an additional file(e.g. run.txt). Later on that file name is to be passed as an argument to appletviewer.exe as shown below</li>
</ol>
<p><strong>File name:</strong> run.txt</p>
<pre class="brush: xml; title: ; notranslate">
&lt;applet code=&quot;abc&quot; width=&quot;500&quot; height=&quot;500&quot;&gt;&lt;/applet&gt;
</pre>
<p><strong>Commands to be executed:</strong> run.txt</p>
<pre class="brush: xml; title: ; notranslate">
c:&gt; javac abc.java
c:&gt; appletviewer run.txt
</pre>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/java-tutorials/applet/what-is-an-applet">What is an Applet?</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankit.co/tutorials/java-tutorials/applet/what-is-an-applet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Applet Life Cycle</title>
		<link>http://ankit.co/tutorials/java-tutorials/applet/applet-life-cycle?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=applet-life-cycle</link>
		<comments>http://ankit.co/tutorials/java-tutorials/applet/applet-life-cycle#comments</comments>
		<pubDate>Thu, 03 Jan 2013 18:14:29 +0000</pubDate>
		<dc:creator><![CDATA[Sonali Virparia]]></dc:creator>
				<category><![CDATA[Applet]]></category>
		<category><![CDATA[Life Cycle]]></category>

		<guid isPermaLink="false">http://ankit.co/?p=87</guid>
		<description><![CDATA[<p>Applet life cycle consists of 5 methods which will be automatically invoked by JRE when some action is done on the application/browser. List of Methods: public void init() public void start() public void stop() public void destroy() public void paint(Graphics g) Which method will be invoked when? init() Invoked only once Invoked when the application [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/java-tutorials/applet/applet-life-cycle">Applet Life Cycle</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Applet life cycle consists of 5 methods which will be automatically invoked by JRE when some action is done on the application/browser.</p>
<p><strong>List of Methods:</strong></p>
<ol>
<li>public void init()</li>
<li>public void start()</li>
<li>public void stop()</li>
<li>public void destroy()</li>
<li>public void paint(Graphics g)</li>
</ol>
<p><strong>Which method will be invoked when?</strong></p>
<p><strong>init()</strong></p>
<ul>
<li>Invoked only once</li>
<li>Invoked when the application is launched using appletviewer or browser</li>
<li>Should include code for component defination, Object creation, Layout settings, Basic look and feel</li>
</ul>
<p><strong>start()</strong></p>
<ul>
<li>Invoked when application is maximized</li>
<li>Default application state is Maximized window so this will also be invoked on launching</li>
<li>Should include code for starting/resuming thread, starting/resuming Graphical User Interface, etc&#8230;</li>
</ul>
<p><strong>stop()</strong></p>
<ul>
<li>Invoked when application is minimized</li>
<li>invoked also when the window is terminated while its in maximizes state.</li>
<li>Should include code for pausing/stopping thread, pausing/stopping Graphical User Interface, etc&#8230;</li>
</ul>
<p><strong>destroy()</strong></p>
<ul>
<li>Invoked when application is about to terminate</li>
<li>invoked when we close the application.</li>
<li>Should include code for connection closing, file closing, etc&#8230;</li>
</ul>
<p><strong>paint()</strong></p>
<ul>
<li>Invoked when application is to be refreshed in terms of GUI</li>
<li>invoked when we start, move or resize applet.</li>
<li>Should include code for GUI design</li>
</ul>
<p><strong>Some method calling scenarios:</strong></p>
<p>On <strong>Launching</strong> an Applet application:  <strong>init(), start(), paint()</strong></p>
<p>On <strong>Minimizing</strong> an Applet application:  <strong>stop()</strong></p>
<p>On <strong>Maximizing</strong> an Applet application: <strong>start(), paint()</strong></p>
<p>On <strong>Moving/Re-sizing</strong> an Applet application: <strong>paint(), paint(), &#8230;, paint()</strong></p>
<p>On <strong>Terminating</strong> an Applet application: <strong>stop(), destroy()</strong></p>
<p>The post <a rel="nofollow" href="http://ankit.co/tutorials/java-tutorials/applet/applet-life-cycle">Applet Life Cycle</a> appeared first on <a rel="nofollow" href="http://ankit.co">Ankit Virparia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://ankit.co/tutorials/java-tutorials/applet/applet-life-cycle/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
