<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3728070035494902299</id><updated>2024-11-08T07:39:53.353-08:00</updated><category term="java 2 micro edition"/><category term="java"/><category term="jexpert"/><category term="materials"/><category term="OOP"/><category term="exercise"/><category term="tutorial"/><category term="j2me"/><category term="Objects"/><category term="midlet"/><category term="keywords"/><category term="socket programming"/><category term="operators"/><category term="statement"/><category term="framework"/><category term="Downloads"/><category term="Obfuscation"/><category term="classes"/><category term="java buzzwords"/><category term="jinfo"/><category term="reserver"/><category term="SIP"/><category term="Internet Calling"/><category term="alert"/><category term="checkbox"/><category term="choice group"/><category term="conditional"/><category term="constructor"/><category term="datagram"/><category term="date"/><category term="format"/><category term="http"/><category term="http connection"/><category term="icon"/><category term="kxml"/><category term="kxml parser"/><category term="login"/><category term="parser"/><category term="phone book"/><category term="scope"/><category term="thread processing"/><category term="udp"/><category term="white paper"/><category term="xml parser"/><title type='text'>jExpertize</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-3404213640201453316</id><published>2012-06-15T23:30:00.000-07:00</published><updated>2012-06-15T23:30:27.854-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="http"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="udp"/><title type='text'>java 2 micro edition used HTTP vs UDP vs Socket</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In the case of MIDP, the specification only requires support for HTTP, although many devices support datagrams and sockets as well, because these protocols are needed to implement HTTP. However, before making commitments to datagrams or sockets it is a good idea to make sure they are supported on the platforms you are targeting.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Because HTTP is guaranteed to be supported by MIDP this is usually the best protocol choice due to portability. HTTP moves through firewalls easily since it generally operates over port 80. However, of the three protocols discussed, HTTP incurs the most overhead, which may drive up the user&#39;s cost of using the application on the network.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Datagrams, on the other hand, tend to have far less overhead and can be easier on the end-user&#39;s budget. The caveat, as discussed previously, is that the application must take on the task of ensuring that all data arrived at the other end and that the order of that data received is correct.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Finally, sockets fall somewhere in the middle of HTTP and datagrams in that data sent over a socket is managed by the protocol, but requires fewer network resources than HTTP. This means that the application does not have to concern itself with making sure data is received on the other end. Sockets are generally a lighter-weight option over HTTP since the application controls when the end points communicate. HTTP, on the other hand, must make several trips between the end points to exchange header information as well as the data.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The GCF provides a lot of functionality and standardizes how connections are established throughout the J2ME architecture. The GCF is extensible as well, allowing manufacturers to support their own interfaces and connection types. In some cases a manufacturer may use the GCF to support streaming multimedia content with a special connection or for establishing connections to a GPS receiver. Having this kind of flexibility prevents J2ME from being constrained to a common set of protocols while maintaining consistency throughout the architecture.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/3404213640201453316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-used-http-vs-udp.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/3404213640201453316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/3404213640201453316'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-used-http-vs-udp.html' title='java 2 micro edition used HTTP vs UDP vs Socket'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-1584713768628969947</id><published>2012-06-15T23:28:00.000-07:00</published><updated>2012-06-15T23:28:01.917-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="http connection"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Using HttpConnection in J2ME (Retrieve web content from a website to a phone)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This J2ME example will cover reading data using the MIDP HttpConnection. Note that this connection interface is not part of the CLDC or CDC, but is defined rather in the MIDP and Personal Profiles themselves. The behavior of HttpConnection is one that combines an InputStream and an OutputStream into a single connection. A single HttpConnection may open and use exactly one OutputStream and exactly one InputStream. The order in which the streams are used is important as well. The OutputStream, if used, must be used before the InputStream. Once the streams have been used the connection should be closed and a new HttpConnection should be opened to continue communications if necessary. This follows the HTTP request-response paradigm.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The HttpConnection is a bit more tricky to use than the socket or datagram connections because there is a lot that happens behind the scenes. There are three states to an HttpConnection:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; Setup&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; Connected&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; Closed&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The setup state is the first state encountered after a connection is opened. While in this state, connection parameters can be set such as the request method (GET, POST or HEAD) using the setRequestMethod() method or any header properties using the setRequestProperty() method.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The transition from setup to connected is triggered by any methods that cause data to be sent to the server. The following is a list of methods that cause this transition.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; openInputStream&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; openDataInputStream&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getLength&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getType&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getEncoding&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getHeaderField&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getResponseCode&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getResponseMessage&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getHeaderFieldInt&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getHeaderFieldDate&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getExpiration&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getDate&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getLastModified&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getHeaderField&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp; &amp;nbsp; getHeaderFieldKey&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Once the connection transitions to the connected state, any calls to setRequestMethod() and setRequestProperty() will throw an IOException. The state transition from setup to connected reflects the underlying handshake of the HttpConnection as headers are sent to the server and the connection prepares to send data. The following example demonstrates reading Web content from an HttpConnection.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
HttpConnection c = null;&lt;br /&gt;
InputStream is = null;&lt;br /&gt;
StringBuffer sb = new StringBuffer();&lt;br /&gt;
try {&lt;br /&gt;
&amp;nbsp; c = (HttpConnection)Connector.open(&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&quot;http://www.java-samples.com”,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;Connector.READ_WRITE, true);&lt;br /&gt;
&amp;nbsp; c.setRequestMethod(HttpConnection.GET); //default&lt;br /&gt;
&amp;nbsp; is = c.openInputStream(); // transition to connected!&lt;br /&gt;
&amp;nbsp; int ch = 0;&lt;br /&gt;
&amp;nbsp; for(int ccnt=0; ccnt &amp;lt; 150; ccnt++) { // get the title.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ch = is.read();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; if (ch == -1){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; sb.append((char)ch);&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
catch (IOException x){&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;x.printStackTrace();&lt;br /&gt;
}&lt;br /&gt;
finally{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;try &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;is.close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c.close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;} catch (IOException x){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x.printStackTrace();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
System.out.println(sb.toString());&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In this example, the server at www.java-samples.com is contacted. Because this is an HttpConnection and no port is specified, port 80 is used by default. The request method is set to GET (note GET is the default and is explicitly set here only for the example).&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/1584713768628969947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1584713768628969947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1584713768628969947'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-using.html' title='java 2 micro edition tutorial of Using HttpConnection in J2ME (Retrieve web content from a website to a phone)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-8354473604155606809</id><published>2012-06-15T23:25:00.000-07:00</published><updated>2012-06-15T23:25:22.010-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="datagram"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="SIP"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Datagrams in J2ME (UDP Programming)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
It is quite possible for someone to have worked with Java for some time without ever needing to understand or use datagrams. For mobile devices, however, datagrams offer some advantages in that they are rather lightweight when compared to TCP-based connections such as sockets. User Datagram Protocol, UDP, is one of the more common datagram protocols. However, because most datagram protocols follow the same basic principals as to their usage, the GCF is able to support datagrams generically.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Datagrams are based on a connection-less paradigm, which means that a conversation is not established between two systems. Instead, datagrams are blindly transmitted across a network connection. To transmit a datagram from one system to another, an application creates a datagram and sends it to the intended target. This is a rather simple process in J2ME. However, there is a caveat to using datagrams in that they offer no guarantee or acknowledgement as to whether the datagram actually reached the intended recipient. As a result, a datagram implementation must either not care if the recipient actually receives the data 100 percent of the time, or an acknowledgement/handshake must be implemented manually by the application.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Using Datagrams&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The following example shows how to create a datagram and send it to a specific IP address.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
try&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;{&lt;br /&gt;
&amp;nbsp; DatagramConnection dgc = (DatagramConnection)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Connector.open(&quot;datagram://localhost:9001&quot;);&lt;br /&gt;
&amp;nbsp; try {&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; byte[] payload = &quot;Test Message&quot;.getBytes();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Datagram datagram =&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; dgc.newDatagram(payload, payload.length);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; dgc.send(datagram);&lt;br /&gt;
&amp;nbsp; } finally {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; dgc.close();&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
} catch (IOException x) {&lt;br /&gt;
&amp;nbsp; x.printStackTrace();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In this example, a MIDlet creates a Datagram containing the text &quot;Hello from a Datagram&quot; and sends it to an application listening for datagrams on the local machine on port 9001. This example will execute just fine even if there is no application running to receive the datagram, thus demonstrating the connection-less nature of datagrams. The sender has no indication that the datagram was consumed by the target system.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Next I show how an application might receive the datagram sent by the previous code snippet.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
try {&lt;br /&gt;
&amp;nbsp; DatagramConnection dgc = (DatagramConnection)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Connector.open(&quot;datagram://:9001&quot;);&lt;br /&gt;
&amp;nbsp; try {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; int size = 100;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Datagram datagram = dgc.newDatagram(size);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; dgc.receive(datagram);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.out.println(&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; new String(datagram.getData()).trim());&lt;br /&gt;
&amp;nbsp; } finally {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; dgc.close();&lt;br /&gt;
&amp;nbsp; }&lt;br /&gt;
} catch (IOException x){&lt;br /&gt;
&amp;nbsp; x.printStackTrace();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In the receive example, a datagram connection is established on port 9001. A datagram is created with a size of 100 bytes; if a received datagram contains more than 100 bytes, any data beyond the 100-byte mark is ignored. Once the datagram is created the receive() method is called, putting the thread in a wait state until a datagram is received. When a datagram is received, the payload is extracted from the datagram container and printed to the console.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In order to run the send and the receive examples, two instances of a MIDlet can be run from the Wireless Toolkit, one to perform the receive and one to perform the send.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/8354473604155606809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/8354473604155606809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/8354473604155606809'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of_15.html' title='java 2 micro edition tutorial of Datagrams in J2ME (UDP Programming)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-4551194101762813080</id><published>2012-06-15T23:20:00.000-07:00</published><updated>2012-06-15T23:20:22.639-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="icon"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of adding own Application icon</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
It is normally used the default icon which is seen as soon as the installation of a jar file
is complete. if you&amp;nbsp; want to see your own icon for launching the
application after installing the jar file then here is how you can do this.To
achieve this manually just
add following entry into your JAD/Manifest files:&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
MIDlet-1: &amp;lt;App Name&amp;gt;,&amp;lt;AppIcon&amp;gt;,&amp;lt;MidletClass&amp;gt;
where AppIcon is the name of icon image file along with path in the JAR file
where it resides in the Jar ex: /app/appicon.png&amp;nbsp;or else&amp;nbsp;You can add the MIDlet-Icon attribute that contains the absolute path of
the icon file for the MIDlet suite, relative to the JAR file itself.&lt;/div&gt;
&lt;br /&gt;

&lt;div style=&quot;text-align: justify;&quot;&gt;
If
you are using an IDE, then follow the steps below:&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;

&lt;ol&gt;
&lt;li&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;For
    the Netbeans IDE&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
    Just go to the project properties,&lt;br /&gt;
      then go to the application descriptor.&lt;br /&gt;
      and now click the midlet tab then you will find the icon option,correct.&lt;br /&gt;
      Then click on this icon drop down and provide the name of the icon.&lt;br /&gt;
      Thats all.&lt;br /&gt;
    
   
  &lt;/li&gt;
&lt;li&gt;&lt;b&gt;For
    the eclipse + mtj&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
    &lt;br /&gt;
    #Open the eclipse&lt;br /&gt;
    #Find your project&lt;br /&gt;
    #Find the Application descriptor&lt;br /&gt;
    #Now give double click with mouse left bottom in this&lt;br /&gt;
    #Find the label &quot;optional&quot; choose it, in the MIDlet icon box put
    the your icon path...e.g. C:\...&lt;br /&gt;
    #save your changes.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/4551194101762813080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-adding.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4551194101762813080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4551194101762813080'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-adding.html' title='java 2 micro edition tutorial of adding own Application icon'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-6049974559935404318</id><published>2012-06-15T00:11:00.000-07:00</published><updated>2012-06-15T00:11:10.385-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="checkbox"/><category scheme="http://www.blogger.com/atom/ns#" term="choice group"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of CheckBox ChoiceGroup</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
How to create check boxes in to your form. In this
example we are creating a &lt;b&gt;Form(&quot;Technologies&quot;)&lt;/b&gt;  that is having
four different choices, &lt;b&gt;ChoiceGroup(&quot;JAVA&quot;,
&quot;J2ME&quot;, &quot;J2EE&quot;, &quot;JSF&quot;). &lt;/b&gt;if user select a check
box and click on &quot;Choose&quot; button then the selected item will be display on
the form. We are using &lt;b&gt;StringItem&lt;/b&gt; to display the selected item on the
form. We are creating a variable of array type&lt;b&gt; (&quot;message[ ]&quot;) &lt;/b&gt;and
stored the size of selected item in it. Next we are creating a boolean type array
&lt;b&gt;(&quot;get[ ]&quot;) &lt;/b&gt;to store the size of selected item then
we have given a condition if &lt;b&gt; get[]&lt;/b&gt; returns true then this will display the &lt;b&gt;StringItem()&lt;/b&gt;
with message and String value of selected item. The StringItem has only 2
methods that is:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;getText()&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;setText(String text)&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Constructor StringItem Syntax is:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;StringItem(String label, String text)&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;lcdui&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;midlet&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;CheckBoxExample&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;MIDlet&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;implements&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;CommandListener&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; display&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; exit&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; choose&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;ChoiceGroup&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; index&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;CheckBoxExample&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Technologies&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; technology &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;ChoiceGroup&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Select Technology Which You Know&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Choice&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;MULTIPLE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; exit &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Exit&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;EXIT&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; choose &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Choose&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;SCREEN&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; startApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; display &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;JAVA&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;J2ME&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;J2EE&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;JSF&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; 

&amp;nbsp; index &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;addCommand&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;exit&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;addCommand&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;choose&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;setCommandListener&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; display&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; pauseApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; destroyApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; unconditional&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; notifyDestroyed&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; commandAction&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Command&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Displayable&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; displayable&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; label &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; c&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getLabel&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Choose&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;StringItem&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; message&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;StringItem&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()];&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; get&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;size&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()];&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getSelectedFlags&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; i &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; get&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;++)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;get&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;])&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; message&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;StringItem&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Your Choice is: &quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; technology&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getString&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;message&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;]);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;removeCommand&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;choose&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;label&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Exit&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; destroyApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/6049974559935404318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6049974559935404318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6049974559935404318'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of.html' title='java 2 micro edition tutorial of CheckBox ChoiceGroup'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-1113700614087483648</id><published>2012-06-15T00:08:00.001-07:00</published><updated>2012-06-15T00:08:24.963-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="date"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="format"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Date Field</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
How to insert date field in your form. We are using
here two fields &lt;b&gt;DateField&lt;/b&gt; (&lt;b&gt;datein&lt;/b&gt; and &lt;b&gt;dateout)&lt;/b&gt; and initialize a
final static variable &lt;b&gt;DATE&lt;/b&gt;  which is 0. We are taking both &lt;b&gt;DateField&lt;/b&gt;
variable in to the constructor &lt;b&gt;(DateFieldExample). &lt;/b&gt;When application will run, first of all the &lt;b&gt;startApp()&lt;/b&gt; method will
be called and it will display
the form with &lt;b&gt;datein&lt;/b&gt; and &lt;b&gt;dateout&lt;/b&gt; field.&lt;b&gt; &lt;/b&gt;For the specific
date we are using here &lt;b&gt;java.util.Date&lt;/b&gt; class and &lt;b&gt;java.util.TimeZone&lt;/b&gt;
class is used to show the format of date.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;lcdui&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;midlet&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;MIDlet&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; java&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Date&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; java&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;util&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;TimeZone&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateFieldExample&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;MIDlet&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; display&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateField&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; datein&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; dateout&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;private&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;static&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;final&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; DATE &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateFieldExample&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; datein &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateField&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Date In:&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateField&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;TimeZone&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getTimeZone&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;GMT&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; dateout &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateField&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Date Out:&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;DateField&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;DATE&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;TimeZone&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getTimeZone&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;GMT&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;));&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; startApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; display &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Display&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getDisplay&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; form &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;Date Field&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;datein&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;dateout&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; display&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;setCurrent&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; pauseApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; 
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; destroyApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; destroy&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; notifyDestroyed&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/1113700614087483648/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-date.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1113700614087483648'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1113700614087483648'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-date.html' title='java 2 micro edition tutorial of Date Field'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-2748522116787088229</id><published>2012-06-15T00:04:00.001-07:00</published><updated>2012-06-15T00:04:41.302-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="phone book"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of create Contact List</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Creating your phone book. In this example
we are taking three &lt;b&gt;SCREEN&lt;/b&gt; button &lt;b&gt;(&quot;Next&quot;, &quot;New&quot;,
&quot;Exit&quot;)&lt;/b&gt; and taking two &lt;b&gt;TextBox&lt;/b&gt; &lt;b&gt;(&quot;name&quot;,
&quot;number&quot;). &lt;/b&gt;In the name field user enters name and in number field
user enters phone number. When user enters name and click on Next button then
number text box will open, now user enters phone number. In case user
select&amp;nbsp; &lt;b&gt;&quot;Exit&quot;&lt;/b&gt; or&amp;nbsp; &lt;b&gt;&quot;New&quot;&lt;/b&gt; the name and number
get prints on the console.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
 When
program will run initially, &lt;b&gt;startApp()&lt;/b&gt; method will be called. And both
&quot;Enter Name&quot; text box and the &quot;Next&quot; button will be
displayed. After that if user clicks on next button the commandAction() method
will be called that will check, if label is equal to &quot;Next&quot; then number &lt;b&gt;TextBox&lt;/b&gt;
will appear on the screen that can be used to enter the phone number of
user.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;code&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.lcdui.*;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.midlet.*;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;code&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PhoneBookExample&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MIDlet&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;implements&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;CommandListener&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&amp;nbsp;exit,&amp;nbsp;next,&amp;nbsp;New;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TextBox&amp;nbsp;name,&amp;nbsp;number;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Display&amp;nbsp;display;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;String&amp;nbsp;nam,&amp;nbsp;no;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form&amp;nbsp;form;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;PhoneBookExample&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;next&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Next&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Command.SCREEN,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;exit&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Command.SCREEN,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;New&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;New&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Command.SCREEN,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;startApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&amp;nbsp;=&amp;nbsp;Display.getDisplay&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TextBox&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Enter&amp;nbsp;Name&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;TextField.ANY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name.addCommand&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;next&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name.setCommandListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;number&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TextBox&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Enter&amp;nbsp;Number&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;13&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;TextField.PHONENUMBER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;number.addCommand&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;number.addCommand&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;exit&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;number.setCommandListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;pauseApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;{}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;boolean&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;unconditional&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;notifyDestroyed&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;commandAction&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&amp;nbsp;c,&amp;nbsp;Displayable&amp;nbsp;s&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;String&amp;nbsp;label&amp;nbsp;=&amp;nbsp;c.getLabel&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;label.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;nam&amp;nbsp;=&amp;nbsp;name.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;no&amp;nbsp;=&amp;nbsp;number.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Name&amp;nbsp;=&amp;nbsp;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&amp;nbsp;name.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;,&lt;br /&gt;
&amp;nbsp; Number&amp;nbsp;=&amp;nbsp;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&amp;nbsp;number.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;false&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;else&amp;nbsp;if&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;label.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Next&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;number.setString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;number&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;else&amp;nbsp;if&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;label.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;New&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;nam&amp;nbsp;=&amp;nbsp;name.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;no&amp;nbsp;=&amp;nbsp;number.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Name&amp;nbsp;=&amp;nbsp;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&amp;nbsp;name.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;,&lt;br /&gt;
&amp;nbsp; Number&amp;nbsp;=&amp;nbsp;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&amp;nbsp;number.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name.setString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/2748522116787088229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-create.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/2748522116787088229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/2748522116787088229'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-create.html' title='java 2 micro edition tutorial of create Contact List'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-7747533226206346284</id><published>2012-06-15T00:01:00.000-07:00</published><updated>2012-06-15T00:01:00.707-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Downloads"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="login"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of  MIDlet Application For Login</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Creating the MIDlet application for user login . &lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;All
MIDlet applications for the MIDP ( Mobile Information Device Profile) derived
from&amp;nbsp; MIDlet class and it play a role as a mediator between the application
and the environment in which the application runs. The MIDlet life cycle manage the flow of application.
It is in the &lt;b&gt;javax.microedition.midlet&lt;/b&gt; &lt;tt&gt; &lt;/tt&gt;package, so import this
package in your application.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Times New Roman&#39;;&quot;&gt;The&amp;nbsp;&lt;/span&gt;&lt;b&gt;javax.microedition.icdui&lt;/b&gt; package is used
for following classes:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Alert&lt;/li&gt;
&lt;li&gt;AlertType&lt;/li&gt;
&lt;li&gt;Canvas&lt;/li&gt;
&lt;li&gt;ChoiceGroup&lt;/li&gt;
&lt;li&gt;Command&lt;/li&gt;
&lt;li&gt;DateField&lt;/li&gt;
&lt;li&gt;Display&lt;/li&gt;
&lt;li&gt;Displayable&lt;/li&gt;
&lt;li&gt;Font&lt;/li&gt;
&lt;li&gt;Form&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gauge&lt;/li&gt;
&lt;li&gt;Graphics&lt;/li&gt;
&lt;li&gt;Image&lt;/li&gt;
&lt;li&gt;ImageItem&lt;/li&gt;
&lt;li&gt;Item&lt;/li&gt;
&lt;li&gt;List&lt;/li&gt;
&lt;li&gt;Screen&lt;/li&gt;
&lt;li&gt;StringItem&lt;/li&gt;
&lt;li&gt;TextBox&lt;/li&gt;
&lt;li&gt;TextField&lt;/li&gt;
&lt;li&gt;Ticker&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Give Your &lt;b&gt;LoginID &#39;xyz&#39;&lt;/b&gt; and &lt;b&gt;Password &#39;xyz&#39;&lt;/b&gt; then it call
the &lt;b&gt;commandAction &lt;/b&gt;where if condition will be executed and it calls a
function (&lt;b&gt;validateUser()&lt;/b&gt;) which checks whether name and password is equal
to &lt;b&gt;&#39;xyz&#39;&lt;/b&gt; or not if it equal to &lt;b&gt;&#39;xyz&#39;&lt;/b&gt; then it executed the &lt;b&gt;showMsg()
&lt;/b&gt;function which show a congratulation message but if &lt;b&gt;name&lt;/b&gt; and &lt;b&gt;password&lt;/b&gt;
is not equal to &#39;&lt;b&gt;xyz&lt;/b&gt;&#39; then it call &lt;b&gt;tryAgain()&lt;/b&gt; function which
show the error page like figure below and it return on login page with refresh
value.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;code&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.midlet.MIDlet;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.lcdui.*;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;LoginExample&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MIDlet&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;implements&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;CommandListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Display&amp;nbsp;display;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TextField&amp;nbsp;userName,password;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form&amp;nbsp;form;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&amp;nbsp;login,cancel;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Image&amp;nbsp;img,&amp;nbsp;imge,&amp;nbsp;img2;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;LoginExample&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Sign&amp;nbsp;in&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;userName&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TextField&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;LoginID:&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;TextField.ANY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;password&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;TextField&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Password:&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;TextField.PASSWORD&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;cancel&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Command.CANCEL,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;login&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Login&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Command.OK,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;try&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;img&amp;nbsp;=&amp;nbsp;Image.createImage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;/logo.png&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;imge&amp;nbsp;=&amp;nbsp;Image.createImage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;/front_left1_bad.png&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;img2&amp;nbsp;=&amp;nbsp;Image.createImage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;/Congratulations-1.png&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;catch&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Exception&amp;nbsp;e&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;e.getMessage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;startApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&amp;nbsp;=&amp;nbsp;Display.getDisplay&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;try&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;catch&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Exception&amp;nbsp;e&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;userName&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;password&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.addCommand&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;cancel&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.addCommand&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;login&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.setCommandListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;pauseApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;{}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;boolean&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;unconditional&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;notifyDestroyed&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;validateUser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;String&amp;nbsp;name,&amp;nbsp;String&amp;nbsp;password&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;if&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;name.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot; xyz &quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;amp;&amp;amp;&amp;nbsp;password.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&lt;/span&gt;
&lt;span style=&quot;color: #2a00ff;&quot;&gt;xyz&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;))&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;showMsg&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;else&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;tryAgain&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;showMsg&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Alert&amp;nbsp;success&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Alert&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Login&amp;nbsp;Successfully&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &quot;Your&amp;nbsp;Login&amp;nbsp;Process&amp;nbsp;is&amp;nbsp;completed!&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; img2,&amp;nbsp;AlertType.INFO&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;success.setImage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;img2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;userName.setString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;password.setString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;success,&amp;nbsp;form&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;tryAgain&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Alert&amp;nbsp;error&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Alert&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Login&amp;nbsp;Incorrect&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Please&lt;br /&gt;
&amp;nbsp; try&amp;nbsp;again&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;imge,&amp;nbsp;AlertType.ERROR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;error.setTimeout&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;900&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;error.setImage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;imge&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;userName.setString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;password.setString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;error,&amp;nbsp;form&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;commandAction&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&amp;nbsp;c,&amp;nbsp;Displayable&amp;nbsp;d&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;String&amp;nbsp;label&amp;nbsp;=&amp;nbsp;c.getLabel&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;label.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Cancel&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;))&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;true&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;else&amp;nbsp;if&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;label.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Login&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;))&amp;nbsp;{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;validateUser&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;userName.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;password.getString&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/7747533226206346284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-midlet_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/7747533226206346284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/7747533226206346284'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-midlet_15.html' title='java 2 micro edition tutorial of  MIDlet Application For Login'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-3975814593587238063</id><published>2012-06-14T00:25:00.000-07:00</published><updated>2012-06-14T00:29:02.846-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="framework"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>Framework in JAVA</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;What is Frameworks?&lt;/b&gt;
    &lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Framework is set of reusable software program that forms the basis for
      an application. Frameworks helps the programmers to build the application
      quickly.
     Earlier it was very hard to develop complex web applications. Now its 
  very easy to develop such application using different kinds of 
  frameworks such as Struts, Struts 2, Hibernate,&amp;nbsp; JSF, Tapestry, 
  JUnit, Log4j, Spring etc.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In Java technology there are so many frameworks that helps the
      programmers to build complex applications easily.    You can choose these 
  frameworks for building your applications.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Software Framework&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Framework software in computer system is a layered structure  
that indicates what kind of program should be built and how they would  
interrelate to one another. In computer system, a framework is a 
conceptual  structure that sometime includes actual programs, which 
specify programming  interface or offer programming tools for using the 
frameworks.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/3975814593587238063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/framework-in-java.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/3975814593587238063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/3975814593587238063'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/framework-in-java.html' title='Framework in JAVA'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-5406174121314881252</id><published>2012-06-14T00:01:00.001-07:00</published><updated>2012-06-14T00:29:02.875-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="kxml"/><category scheme="http://www.blogger.com/atom/ns#" term="kxml parser"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="parser"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="xml parser"/><title type='text'>java 2 micro edition KXML Parser</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
we use &quot;catching parsing events&quot; way to parse
the xml. Through &#39;catching parsing events&#39;, the parser traverses the XML data and issues
callbacks to a previously registered event listener whenever it encounters
particular structures in the data. For example, when the parser encounters an
opening tag such as &amp;lt;employee&amp;gt; then the event listener would receive an
event notifying it of the encounter and pass it any necessary information. A
parser implements such a strategy is called a push parser because the
parser is &quot;pushing&quot; the event to a listener.&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; java&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; org&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;kxml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; org&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;kxml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;parser&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;io&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;lcdui&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;import&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; javax&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;microedition&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;midlet&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.*;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;class&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;KXMLParserExample&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;extends&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;MIDlet&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; emp &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;/employee.xml&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;XmlParser&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; startApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;try&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; parser &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;XmlParser&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;InputStreamReader&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getClass&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getResourceAsStream&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;emp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)),&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot;&gt;300&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;ParseEvent&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Xml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;END_DOCUMENT&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;event&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Xml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;START_TAG&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; event&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;name &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;details&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;----------[ EMP-DETAILS ]----------&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; parseAddressTag&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;-----------------------------------\n&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; name &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;catch&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;IOException&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; ioe&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;XML Parsing Error: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; ioe&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; ioe&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;printStackTrace&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;finally&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; parser &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &amp;nbsp;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; pauseApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(){}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; 
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;public&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parseAddressTag&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;XmlParser&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;throws&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;IOException&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;ParseEvent&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;while&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;peek&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()).&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Xml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;END_DOCUMENT&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; event&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; type &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; event&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;type &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Xml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;END_TAG &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; name&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;equals&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;details&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; name &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;type &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Xml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;START_TAG&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;ParseEvent&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; next &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; parser&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;next&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getType&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;!=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;Xml&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;TEXT&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; next &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;continue&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; text &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; next&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;getText&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;typ&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;println&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; name &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&quot;: &quot;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; text &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; event &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; text &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; next &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;

&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;protected&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;void&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; destroyApp&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kwd&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; arg&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;){&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; notifyDestroyed&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;();&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&amp;nbsp; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;pln&quot;&gt;&lt;b&gt;employee.xml&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;pln&quot;&gt;&lt;b&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;&lt;span class=&quot;pln&quot;&gt;&amp;lt;employee&amp;gt;    

      &amp;nbsp; &amp;lt;details&amp;gt;

      &amp;nbsp; &amp;lt;name&amp;gt;Sandeep Kumar Suman&amp;lt;/name&amp;gt;

      &amp;nbsp; &amp;lt;designation&amp;gt;J2ME Programmer&amp;lt;/designation&amp;gt;

      &amp;nbsp; &amp;lt;city&amp;gt;Gorakhpur&amp;lt;/city&amp;gt;

      &amp;nbsp; &amp;lt;state&amp;gt;UP&amp;lt;/state&amp;gt;

      &amp;nbsp; &amp;lt;/details&amp;gt;

&amp;lt;/employee&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/5406174121314881252/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-kxml-parser.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/5406174121314881252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/5406174121314881252'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-kxml-parser.html' title='java 2 micro edition KXML Parser'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-3771805558039401512</id><published>2012-06-13T23:53:00.001-07:00</published><updated>2012-06-14T00:29:02.835-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="thread processing"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Thread Processing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
How thread works in
J2ME application. An application can run multiple activities simultaneously
using thread. Here we have defined different states of thread...&lt;br /&gt;

&lt;br /&gt;
The states of Thread is:&lt;br /&gt;

&lt;ul&gt;
&lt;li&gt;&lt;b&gt;running:- &lt;/b&gt;Executing code.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ready:- &lt;/b&gt;Ready to execute code.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;suspended:-&lt;/b&gt; Waiting on an external event.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;terminated:- &lt;/b&gt;Finished executing code.&lt;/li&gt;
&lt;/ul&gt;
In the output First of all &lt;b&gt;process()&lt;/b&gt; thread will be executed then &lt;b&gt;start()&lt;/b&gt;
thread and then &lt;b&gt;run()&lt;/b&gt; thread will be executed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint lang-java&quot;&gt;import&amp;nbsp;java.io.*;
import&amp;nbsp;javax.microedition.io.*;
import&amp;nbsp;javax.microedition.lcdui.*;
import&amp;nbsp;javax.microedition.midlet.*;

public&amp;nbsp;class&amp;nbsp;ThreadProcessing&amp;nbsp;extends&amp;nbsp;MIDlet&amp;nbsp;implements&amp;nbsp;CommandListener{
&amp;nbsp;&amp;nbsp;private&amp;nbsp;Display&amp;nbsp;display;
&amp;nbsp;&amp;nbsp;private&amp;nbsp;Ticker&amp;nbsp;ticker;
&amp;nbsp;&amp;nbsp;private&amp;nbsp;Form&amp;nbsp;form;&amp;nbsp;
&amp;nbsp;&amp;nbsp;private&amp;nbsp;Command&amp;nbsp;exit,&amp;nbsp;start;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
&amp;nbsp;&amp;nbsp;public&amp;nbsp;ThreadProcessing(){
&amp;nbsp;&amp;nbsp;form&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Form(&quot;Thread&amp;nbsp;Processing&quot;);
&amp;nbsp;&amp;nbsp;ticker&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Ticker&amp;nbsp;(&quot;10/17/2008&amp;nbsp;3:59:59&amp;nbsp;PM&amp;nbsp;ACC&amp;nbsp;LTD&amp;nbsp;489.05&amp;nbsp;(-6.42%)
BHARTI&amp;nbsp;ARTL&amp;nbsp;676.80&amp;nbsp;(-7.47%)&amp;nbsp;BHEL&amp;nbsp;1,194.80&amp;nbsp;(-9.00%)
ACC&amp;nbsp;LTD&amp;nbsp;489.05&amp;nbsp;(-6.42%)&amp;nbsp;&amp;nbsp;BHARTI&amp;nbsp;ARTL&amp;nbsp;676.80&amp;nbsp;(-7.47%)
&amp;nbsp;BHEL&amp;nbsp;1,194.80&amp;nbsp;(-9.00%)&amp;nbsp;DLF&amp;nbsp;LTD*&amp;nbsp;291.30&amp;nbsp;(-10.34%)
&amp;nbsp;GRASIM&amp;nbsp;INDUSTRIES&amp;nbsp;LTD.&amp;nbsp;1,293.40&amp;nbsp;(-5.71%)&amp;nbsp;HDFC&amp;nbsp;BANK&amp;nbsp;LT&amp;nbsp;1,024.05&amp;nbsp;(-5.82%)&quot;);
&amp;nbsp;&amp;nbsp;exit&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Command(&quot;Exit&quot;,&amp;nbsp;Command.EXIT,&amp;nbsp;1);
&amp;nbsp;&amp;nbsp;start&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Command(&quot;Start&quot;,&amp;nbsp;Command.SCREEN,&amp;nbsp;2);&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;public&amp;nbsp;void&amp;nbsp;startApp(){
&amp;nbsp;&amp;nbsp;display&amp;nbsp;=&amp;nbsp;Display.getDisplay(this);
&amp;nbsp;&amp;nbsp;form.addCommand(exit);
&amp;nbsp;&amp;nbsp;form.addCommand(start&amp;nbsp;);&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;form.setCommandListener(this);
&amp;nbsp;&amp;nbsp;form.setTicker(ticker);
&amp;nbsp;&amp;nbsp;display.setCurrent(form);
&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;public&amp;nbsp;void&amp;nbsp;pauseApp(){&amp;nbsp;}

&amp;nbsp;&amp;nbsp;public&amp;nbsp;void&amp;nbsp;destroyApp(boolean&amp;nbsp;unconditional){
&amp;nbsp;&amp;nbsp;notifyDestroyed();
&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;public&amp;nbsp;void&amp;nbsp;commandAction(Command&amp;nbsp;c,&amp;nbsp;Displayable&amp;nbsp;displayable){
&amp;nbsp;&amp;nbsp;String&amp;nbsp;label&amp;nbsp;=&amp;nbsp;c.getLabel();
&amp;nbsp;&amp;nbsp;if&amp;nbsp;(label.equals(&quot;Exit&quot;)){
&amp;nbsp;&amp;nbsp;destroyApp(false);
&amp;nbsp;&amp;nbsp;}else&amp;nbsp;if&amp;nbsp;(label.equals(&quot;Start&quot;)){
&amp;nbsp;&amp;nbsp;Process&amp;nbsp;process&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Process(this);
&amp;nbsp;&amp;nbsp;process.start();&amp;nbsp;
&amp;nbsp;&amp;nbsp;}&amp;nbsp;
&amp;nbsp;&amp;nbsp;}
}

class&amp;nbsp;Process&amp;nbsp;implements&amp;nbsp;Runnable{
&amp;nbsp;&amp;nbsp;private&amp;nbsp;ThreadProcessing&amp;nbsp;MIDlet;

&amp;nbsp;&amp;nbsp;public&amp;nbsp;Process(ThreadProcessing&amp;nbsp;MIDlet){&amp;nbsp;
&amp;nbsp;&amp;nbsp;this.MIDlet&amp;nbsp;=&amp;nbsp;MIDlet;
&amp;nbsp;&amp;nbsp;System.out.println(&quot;Thread&amp;nbsp;Process...&quot;);
&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;public&amp;nbsp;void&amp;nbsp;run(){
&amp;nbsp;&amp;nbsp;try{
&amp;nbsp;&amp;nbsp;transmit();
&amp;nbsp;&amp;nbsp;System.out.println(&quot;Thread&amp;nbsp;Run...&quot;);
&amp;nbsp;&amp;nbsp;}catch(Exception&amp;nbsp;error){&amp;nbsp;
&amp;nbsp;&amp;nbsp;System.err.println(error.toString());
&amp;nbsp;&amp;nbsp;}&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;public&amp;nbsp;void&amp;nbsp;start(){
&amp;nbsp;&amp;nbsp;Thread&amp;nbsp;thread&amp;nbsp;=&amp;nbsp;new&amp;nbsp;Thread(this);
&amp;nbsp;&amp;nbsp;try{
&amp;nbsp;&amp;nbsp;thread.start();
&amp;nbsp;&amp;nbsp;System.out.println(&quot;Thread&amp;nbsp;Start...&quot;);
&amp;nbsp;&amp;nbsp;}catch(Exception&amp;nbsp;error){}
&amp;nbsp;&amp;nbsp;}

&amp;nbsp;&amp;nbsp;private&amp;nbsp;void&amp;nbsp;transmit()&amp;nbsp;throws&amp;nbsp;IOException{}&amp;nbsp;

}&lt;/pre&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/3771805558039401512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-thread.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/3771805558039401512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/3771805558039401512'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-thread.html' title='java 2 micro edition tutorial of Thread Processing'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-4447365801877613106</id><published>2012-06-13T13:28:00.001-07:00</published><updated>2012-06-14T00:29:02.854-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="alert"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of alert</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Sound Alerts using MIDlet in J2ME&lt;/b&gt;&lt;br /&gt;
This example illustrates how to create&amp;nbsp; alert through sound. In this
example we are using &lt;b&gt; AlertType&lt;/b&gt; class for&amp;nbsp;the different alert. The &lt;b&gt;AlertType()&lt;/b&gt;
class has only one method:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;playSound(Display display):-&lt;/b&gt; This is the boolean type method, it is
    used to Alert user by playing the sound.&lt;/li&gt;
&lt;/ul&gt;
&amp;nbsp;There are different &lt;b&gt;Alert Types&lt;/b&gt;  in J2ME:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;ALARM&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;CONFIRMATION&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;ERROR&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;INFO&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;WARNING&amp;nbsp;&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.midlet.*;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.lcdui.*;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;SoundAlertExample&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MIDlet&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;implements&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ItemStateListener,&amp;nbsp;CommandListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;{&lt;/span&gt;&lt;/code&gt;
    
    &lt;code&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Display&amp;nbsp;display;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form&amp;nbsp;form;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&amp;nbsp;exit;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ChoiceGroup&amp;nbsp;choice;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;startApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(){&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;code&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&amp;nbsp;=&amp;nbsp;Display.getDisplay&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ChoiceGroup&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;List&amp;nbsp;of&amp;nbsp;Sound&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Choice.EXCLUSIVE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Message&amp;nbsp;Tone&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Confirmation&amp;nbsp;Tone&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Warning&amp;nbsp;Tone&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Alarm&amp;nbsp;Tone&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Error&amp;nbsp;Tone&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;exit&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,&amp;nbsp;Command.EXIT,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.append&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.addCommand&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;exit&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.setCommandListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.setItemStateListener&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;pauseApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(){&amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;boolean&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;unconditional&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;notifyDestroyed&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;commandAction&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Command&amp;nbsp;c,&amp;nbsp;Displayable&amp;nbsp;s&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;String&amp;nbsp;label&amp;nbsp;=&amp;nbsp;c.getLabel&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;label.equals&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Exit&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;false&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;itemStateChanged&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Item&amp;nbsp;item&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;switch&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;choice.getSelectedIndex&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;()){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;case&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;AlertType.INFO.playSound&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;case&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;AlertType.CONFIRMATION.playSound&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;case&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;AlertType.WARNING.playSound&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;case&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;AlertType.ALARM.playSound&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;case&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;AlertType.ERROR.playSound&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/4447365801877613106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-alert.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4447365801877613106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4447365801877613106'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-alert.html' title='java 2 micro edition tutorial of alert'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-1293070262390736217</id><published>2012-06-13T13:22:00.000-07:00</published><updated>2012-06-14T00:29:02.779-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="midlet"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of MIDlet lifecycle</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
A MIDlet lifecycle have following steps...&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;startApp()&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;pauseApp()&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;destroyApp()&lt;/b&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
By default MIDlet is in the paused states. when the application is executed by default
&lt;b&gt;startApp()&lt;/b&gt; method will call and when close the application the &lt;b&gt;destroyApp()&lt;/b&gt;
method will be called. But when your constructor is not null type then it will be
executed firstly. The source code of life cycle execution is as follows:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Tutorial:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;table bgcolor=&quot;#FFFFCC&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td width=&quot;100%&quot;&gt;&lt;code&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.lcdui.*;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;import&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;javax.microedition.midlet.MIDlet;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;class&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MidletLifecycle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;extends&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MIDlet{&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form&amp;nbsp;form;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;code&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;private&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Display&amp;nbsp;display;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;MidletLifecycle(){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;MidletLifecycle&amp;nbsp;constructure&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;startApp(){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;new&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;Form(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;Midlet&amp;nbsp;Lifecycle&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display&amp;nbsp;=&amp;nbsp;Display.getDisplay(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;this&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;String&amp;nbsp;msg&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;This&amp;nbsp;is&amp;nbsp;the&amp;nbsp;Lifecycle&amp;nbsp;of&amp;nbsp;Midlet!&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;form.append(msg);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;display.setCurrent(form);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;pauseApp(){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;You&amp;nbsp;are&amp;nbsp;in&amp;nbsp;pauseApp()...&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;public&amp;nbsp;void&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroyApp(&lt;/span&gt;&lt;span style=&quot;color: #7f0055;&quot;&gt;&lt;b&gt;boolean&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;destroy){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;System.out.println(&lt;/span&gt;&lt;span style=&quot;color: #2a00ff;&quot;&gt;&quot;You&amp;nbsp;are&amp;nbsp;in&amp;nbsp;destroyApp()...&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;notifyDestroyed();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/code&gt;
    

            &lt;/td&gt;
          &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;img border=&quot;1&quot; height=&quot;259&quot; src=&quot;http://www.roseindia.net/j2me/midlet.gif&quot; width=&quot;368&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Figure: MIDlet lifecycle&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/1293070262390736217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-midlet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1293070262390736217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1293070262390736217'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-midlet.html' title='java 2 micro edition tutorial of MIDlet lifecycle'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-7411048390986562205</id><published>2012-06-12T23:51:00.002-07:00</published><updated>2012-06-14T00:29:02.933-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Client Server in J2ME (Socket Programming)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Sockets are different than &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-2-micro-edition-tutorial-of-client.html&quot;&gt;datagrams&lt;/a&gt; because they use a connection-based
paradigm to transmit data. This means that both a sender and a receiver must be
running and establish a communication channel for data to be exchanged. To use a
real-world analogy, a socket connection is like calling a friend on the
telephone. If the friend does not answer, a conversation cannot take place.
Datagrams on the other hand are more like sending a letter to a friend, where a
note is placed into an envelope, addressed, and mailed.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The following code demonstrates how to set up a listener to monitor a port
for an inbound socket connection.
&lt;/div&gt;
&lt;pre&gt;&lt;code&gt;
try
{
  ServerSocketConnection ssc = (ServerSocketConnection) 
  Connector.open(&quot;socket://:9002&quot;);
  StreamConnection sc = null;
  InputStream is = null;
  try{
    sc = ssc.acceptAndOpen();&lt;/code&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;    is = sc.openInputStream();
    int ch = 0;
    StringBuffer sb = new StringBuffer();
    while ((ch = is.read()) != -1){
      sb.append((char)ch);
    }
    System.out.println(sb.toString());
  } finally{
      ssc.close();
      sc.close();
      is.close();
  }
} catch (IOException x) {
    x.printStackTrace();
}&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In this example a &lt;span class=&quot;pf&quot;&gt;ServerSocketConnection&lt;/span&gt; is opened on
port 9002. This type of connection is used for sole purpose of listening for an
inbound socket connection. The code goes into a wait state when the &lt;span class=&quot;pf&quot;&gt;acceptAndOpen()&lt;/span&gt;
method is called. When a socket connection is established, the &lt;span class=&quot;pf&quot;&gt;acceptAndOpen()&lt;/span&gt;
method returns with an instance of a &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-2-micro-edition-tutorial-of-client.html&quot;&gt;SocketConnection&lt;/a&gt;.
Opening an input stream on this connection allows data to be read from the
transmission.
&lt;/div&gt;
&lt;br /&gt;
The next example demonstrates the code required by the client to initiate the
socket connection.
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
try{
  SocketConnection sc = (SocketConnection) 
    Connector.open(&quot;socket://localhost:9002&quot;);
  OutputStream os = null;
  try{
    os = sc.openOutputStream();
    byte[] data = &quot;Hello from a socket!&quot;.getBytes();
    os.write(data);
  } finally{
      sc.close();
      os.close();
  }
} catch (IOException x){
 x.printStackTrace();
}&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
In this example a &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-2-micro-edition-tutorial-of-client.html&quot;&gt;SocketConnection&lt;/a&gt; is established on
port 9002 of the local machine. When using sockets, this is the point on the
server side that the &lt;span class=&quot;pf&quot;&gt;acceptAndOpen()&lt;/span&gt; method returns. If
the connection is successfully opened, the &lt;span class=&quot;pf&quot;&gt;OutputStream&lt;/span&gt;
is obtained and a message is written to the stream. Note that because sockets
are connection based, if there is no server listening for an incoming &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-2-micro-edition-tutorial-of-client.html&quot;&gt;SocketConnection&lt;/a&gt; an exception will be thrown.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/7411048390986562205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-client.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/7411048390986562205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/7411048390986562205'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-2-micro-edition-tutorial-of-client.html' title='java 2 micro edition tutorial of Client Server in J2ME (Socket Programming)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-5338943813377842250</id><published>2012-06-12T23:45:00.002-07:00</published><updated>2012-06-14T00:29:02.869-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Play a multimedia file (Audio/Video) using MMAPI</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div align=&quot;LEFT&quot;&gt;
The simplest&amp;nbsp;&lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;MMAPI&lt;/a&gt; MIDlet that can be built allows you to easily
play a multimedia file from within your MIDlet without worrying about controls,
feature sets, or security architecture. If all you’re doing is adding some
sampled audio (or any other media) in a game, &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;MMAPI&lt;/a&gt; allows you to do so in two
lines of code. Listing below shows this code within a complete MIDlet.&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
&lt;b&gt;//&lt;/b&gt;&lt;i&gt;A Simple &lt;/i&gt;&lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;MMAPI&lt;/a&gt;&lt;i&gt;MIDlet&lt;/i&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
import javax.microedition.midlet.MIDlet;&lt;br /&gt;
import javax.microedition.media.Manager;&lt;br /&gt;
import javax.microedition.media.Player;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
public class SimplePlayer extends MIDlet {&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
public void startApp() {&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div align=&quot;LEFT&quot;&gt;
try {&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
Player player =
Manager.createPlayer(getClass().getResourceAsStream(&quot;/media/audio/chapter3/baby.wav&quot;),&quot;audio/x-wav&quot;);&lt;br /&gt;
player.start();&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
} catch(Exception e) {&lt;br /&gt;
e.printStackTrace();&lt;br /&gt;
}&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
}&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
public void pauseApp() {&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
}&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
public void destroyApp(boolean unconditional) {&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
}&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
}&lt;/div&gt;
&lt;div align=&quot;LEFT&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
To keep things simple at this stage, the media file is played by
creating an InputStream on a wav file, which is embedded in the MIDlet’s JAR.
This media file is kept in the folder and is called
baby.wav (which is the sound of a baby crying).&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
You don’t need to play an&amp;nbsp;&lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;audio&lt;/a&gt; file only. You can
substitute the wav file with a&amp;nbsp;&lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;video&lt;/a&gt; file, provided the emulator supports the
format of the video file. The video will not show anywhere, because this listing
doesn’t provide a mechanism to show the &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;video&lt;/a&gt;. You can substitute the wav file
for a midi, tone, or any other supported audio format. The point is that playing
multimedia files using the &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-of-play.html&quot;&gt;MMAPI&lt;/a&gt; is as simple as creating a Player instance
using the Manager class and calling method start() on it.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/5338943813377842250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-micro-edition-tutorial-of-play.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/5338943813377842250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/5338943813377842250'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-micro-edition-tutorial-of-play.html' title='java 2 micro edition tutorial of Play a multimedia file (Audio/Video) using MMAPI'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-4653330512157479384</id><published>2012-06-12T23:39:00.000-07:00</published><updated>2012-06-14T00:29:02.857-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial for send SMS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-for-send.html&quot;&gt;java application&lt;/a&gt;, where on making a Push to talk call, and the call  does not get matured due the the callers phone being busy in another  call, busy in packet data, switched off or not in coverage, the &lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-for-send.html&quot;&gt;java application&lt;/a&gt; installed in the callers phone should send out a sms,  automatically to the called number. The number to send the&amp;nbsp;&lt;a href=&quot;http://jexpertize.blogspot.in/#%21/2012/06/java-micro-edition-tutorial-for-send.html&quot;&gt;SMS&lt;/a&gt; is taken from the phone book for the called number. &lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Here at at first we created a form called send sms  and added commands to exit and send. On clicking the send the control goes to public void sendit(String paramString1, String paramString2). where it first creates a connection with defined addree and and then creates an empty msg of type text. We then added the text that has to be sent and the pass that in the url of the address.&lt;/div&gt;
&lt;br /&gt;
&lt;code&gt; &lt;/code&gt;&lt;br /&gt;
&lt;pre&gt;public void startApp()
 {
   this.display = Display.getDisplay(this);
   this.form = new Form(&quot;send sms&quot;);
   this.text = new TextField(&quot;number&quot;, &quot;&quot;, 256, 0);
   this.send = new Command(&quot;send&quot;, 4, 1);
   this.exit = new Command(&quot;exit&quot;, 3, 2);
   this.form.append(this.text);&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;
   this.form.addCommand(this.send);
   this.form.addCommand(this.exit);
   this.form.setCommandListener(this);
   this.display.setCurrent(this.form);
 }

 public void pauseApp()
 {
 }

 public void destroyApp(boolean paramBoolean)
 {
 }

 public void commandAction(Command paramCommand, Displayable
paramDisplayable) {
   if (paramCommand == this.exit) {
     notifyDestroyed();
   }
   if (paramCommand == this.send) {
     this.number = this.text.getString();
     System.out.println(&quot;in loop&quot; + this.number);
     this.message1 = &quot;please call me back&quot;;
     sendit(this.message1, this.number);
   }
 }

 public void sendit(String paramString1, String paramString2)
 {
   this.phoneNumber = paramString2;
   this.message = paramString1;
   StringBuffer localStringBuffer = new StringBuffer(20);

   String str = &quot;sms://&quot; + paramString2 &quot;;

   this.form2 = new Form(&quot;&quot;);
   MessageConnection localMessageConnection = null;
   try
   {
     localMessageConnection = (MessageConnection)Connector.open(str);

     TextMessage localTextMessage =
(TextMessage)localMessageConnection.newMessage(&quot;text&quot;);
     localTextMessage.setAddress(str);
     localTextMessage.setPayloadText(paramString1);
     localMessageConnection.send(localTextMessage);

     this.form2.append(&quot;message sent&quot;);
     this.display.setCurrent(this.form2);
   }
   catch (Exception localException) {
     this.form2.append(&quot;phone number&quot; + str + localException.getMessage());
     this.display.setCurrent(this.form2);
   }
 }&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/4653330512157479384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-micro-edition-tutorial-for-send.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4653330512157479384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4653330512157479384'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/java-micro-edition-tutorial-for-send.html' title='java 2 micro edition tutorial for send SMS'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-1382601011232297244</id><published>2012-06-11T07:31:00.000-07:00</published><updated>2012-06-14T08:04:31.755-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="classes"/><category scheme="http://www.blogger.com/atom/ns#" term="constructor"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="keywords"/><category scheme="http://www.blogger.com/atom/ns#" term="Obfuscation"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="socket programming"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>how to use Constructors in java?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
When you create an object, you use the new operator to instantiate an object from a class. A String is&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
an object, so you might write:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
String s = new String();&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This statement creates a new, empty string. The second occurrence of the word String is a call to a&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
special method known as a constructor. The constructor&#39;s name is always the same as the class&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
name. Java allows you to have multiple methods with the same name (as long as they have different&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
parameters), so one class can have many different constructors.&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
As with any method, you can also provide arguments for this special constructor. You could write:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
String s = new String(&quot;jExpertize&quot;);&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
When you write your own classes, you&#39;ll provide a constructor for every case you want to handle. If&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
you don&#39;t provide any constructors, Java creates a default constructor (a constructor method with no&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
arguments) for you. If you provide any constructor, however, Java won&#39;t add a default for you; you&#39;ll&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
have to code it if you want a default constructor. Of course, some objects always require construction&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
arguments and therefore don&#39;t have default constructors.&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/1382601011232297244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-constructors-in-java.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1382601011232297244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/1382601011232297244'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-constructors-in-java.html' title='how to use Constructors in java?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-6068908036422206591</id><published>2012-06-11T07:11:00.000-07:00</published><updated>2012-06-14T00:29:02.894-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="Internet Calling"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jinfo"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="SIP"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>java 2 micro edition tutorial of Internet Calling using SIP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&amp;nbsp;The Session Initiation Protocol (SIP) is a signaling protocol used for 
establishing and controlling multimedia communication sessions on 
networks that use the Internet Protocol (IP).  A session may be as 
simple as a two-way phone call or as complex as a collaborative video 
conference. SIP was primarily designed to establish, modify, and 
terminate sessions, and therefore doesn&#39;t know about the details within a
 session. This simplicity makes SIP quite scalable and extensible, and 
it can be used easily in different architectures and deployment 
scenarios. SIP is already being used for all kinds of innovative 
applications and services, and its importance in mobile networks will 
continue to grow. In addition, now that MIDP 2.0 has included support 
for TCP/IP sockets and UDP/IP datagrams, SIP will become an important 
protocol in IP-based mobile phone environments.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This expectation that SIP will play a rapidly growing role in the mobilility space led to the development of the SIP API for J2ME (JSR 180) within the Java Community Process
 (JCP). The motive behind the initiative was to define a single standard
 SIP interface with strong security early, before competing standards, 
with less robust security models, could gain wide acceptance.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
After an overview of SIP, this article:
&lt;/div&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Presents a tutorial that introduces SIP API for J2ME&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Describes how to download, install, and run the JSR 180 reference implementation, available from Nokia&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Discusses how to develop MIDlets that use SIP API for J2ME&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Demonstrates how to compile SIP MIDlets using the J2ME Wireless Toolkit&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Offers a taste of the effort involved in developing SIP MIDlets&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Overview of Session Initiation Protocol&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;contentdivider&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot; &quot; border=&quot;0&quot; height=&quot;4&quot; src=&quot;http://developers.sun.com/im/a.gif&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The Session Initiation Protocol (SIP) was defined by the Internet Engineering Task Force (IETF), in collaboration with the Third Generation Partnership Project (3GPP), as RFC 2543, later superseded by RFC 3261.
 It&#39;s a request-response protocol, just like HTTP, so using it makes 
telephony just another web application, which can be integrated into 
Internet applications and services easily.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
3GPP has specified SIP to be the network protocol of choice for the 
all-IP packet-switched third-generation network. The IP Multimedia 
Subsystem (IMS) represents the architecture defined in 3GPP Releases 5 
and 6 for SIP-based 3G networks. Within the IMS network, mobile 
terminals establish voice calls using the SIP protocol. SIP is used for 
managing sessions between two or more IP endpoints. It defines user 
agents that initiate and respond to SIP requests, and proxies that route
 SIP messages to their destinations. This scheme leads to a host of 
innovative services: voice-based e-commerce, web-page click-to-dial, 
location services, and many more. In addition, it can be used to provide
 instant messaging, presence, and gaming services.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;JSR 180: SIP API for J2ME&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;contentdivider&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot; &quot; border=&quot;0&quot; height=&quot;4&quot; src=&quot;http://developers.sun.com/im/a.gif&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
JSR 180 defines an optional package that provides a general SIP API for 
J2ME clients, so that SIP applications can operate in devices with 
limited memory. This interface enables Java-enabled mobile devices to 
send and receive SIP messages. The API is compact, so it has a small 
footprint, and generic, so you can use it with any J2ME profile, not 
just MIDP. As a minimum, it requires version 1.0 of the Connected 
Limited Device Configuration (CLDC), but the APIs can be used with the 
Connected Device Configuration (CDC) as well. It provides SIP 
functionality at the transaction level; it&#39;s integrated into CLDC&#39;s 
Generic Connection Framework (GCF).
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The APIs are defined in the package &lt;code&gt;javax.microedition.sip&lt;/code&gt;. This package contains eight interfaces and four classes:
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;3&quot; cellspacing=&quot;1&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr valign=&quot;middle&quot;&gt;
&lt;td&gt;&lt;b&gt;Interfaces&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipConnection&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The base interface for SIP connections; holds the common properties and methods for subinterfaces &lt;code&gt;SipClientConnection&lt;/code&gt; and &lt;code&gt;SipServerConnection&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipClientConnection&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents a SIP client transaction. An application can create a new &lt;code&gt;SipClientConnection&lt;/code&gt; using &lt;code&gt;javax.microedition.io.Connector&lt;/code&gt; or &lt;code&gt;SipDialog&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipServerConnection&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents a SIP server transaction; created by the &lt;code&gt;SipConnectionNotifier&lt;/code&gt; when a new request is received.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipConnectionNotifier&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Defines a SIP server connection notifier, which queues incoming 
messages. To receive incoming requests, applications use this 
interface&#39;s &lt;code&gt;acceptAndOpen()&lt;/code&gt; method, which accepts and opens a new &lt;code&gt;SipServerConnection&lt;/code&gt;. If there are no messages in the queue, the method blocks until a new request is received.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipServerConnectionListener&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A listener interface for incoming SIP requests.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipClientConnectionListener&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A listener interface for incoming SIP responses.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipDialog&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Represents one SIP dialog. The &lt;code&gt;SipDialog&lt;/code&gt; can be retrieved from a &lt;code&gt;SipConnection&lt;/code&gt; object when it&#39;s available, which happens after an &lt;code&gt;INVITE&lt;/code&gt; or &lt;code&gt;SUBSCRIBE&lt;/code&gt; request.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipRefreshListener&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A listener interface for the &lt;code&gt;RefreshHelper&lt;/code&gt; class; declares a &lt;code&gt;refreshEvent()&lt;/code&gt; method that takes a &lt;code&gt;refreshID&lt;/code&gt; to identify the corresponding refresh task, and a &lt;code&gt;statusCOde&lt;/code&gt; representing the result of the refresh: &lt;code&gt;0&lt;/code&gt; for cancellation, &lt;code&gt;200&lt;/code&gt; for success, and anything else for failure.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr valign=&quot;middle&quot;&gt;
&lt;td&gt;&lt;b&gt;Classes&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipAddress&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Provides a generic SIP address parser. It can be used to parse a SIP address, or to construct one.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipHeader&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Provides a generic SIP header parser helper. It can be used to parse
 string header values read from SIP messages, or to construct SIP 
headers.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipRefreshHelper&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Implements the functionality that facilitates the handling of refreshing requests on behalf of the application.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr valign=&quot;top&quot;&gt;
&lt;td&gt;&lt;code&gt;SipException&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;An exception class for SIP-specific errors.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
SIP API for J2ME is meant to be used by applications that need to implement SIP user-agent functionality. They can use &lt;code&gt;SipClientConnection&lt;/code&gt; to implement a SIP user-agent client, and use &lt;code&gt;SipConnectionNotifier&lt;/code&gt; and &lt;code&gt;SipServerConnection&lt;/code&gt;
 to implement a SIP user-agent server. A mobile device may act as a SIP 
client sending requests to SIP servers, and also as a SIP server 
accepting requests from SIP clients, as Figure 1 illustrates:
&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;1&quot; cellspacing=&quot;0&quot; style=&quot;text-align: center; width: 154px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;grey3&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; nowrap=&quot;&quot; style=&quot;text-align: center; width: 154px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td bgcolor=&quot;#ffffff&quot; style=&quot;text-align: center;&quot;&gt;&lt;img alt=&quot;Figure 1: Mobile Devices Acting as Both Clients and Servers&quot; border=&quot;0&quot; height=&quot;464&quot; src=&quot;http://developers.sun.com/mobility/apis/articles/sip/fig1.gif&quot; width=&quot;816&quot; /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr nowrap=&quot;&quot;&gt;
&lt;td class=&quot;grey3&quot; style=&quot;text-align: center;&quot;&gt;&lt;div class=&quot;pad6&quot;&gt;
&lt;span class=&quot;dkcaption1&quot;&gt;&lt;i&gt;Figure 1: Mobile Devices Acting as Both Clients and Servers&lt;/i&gt;&lt;br /&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;sp20&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;

&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The SIP APIs are integrated into CLDC&#39;s Generic Connection Framework. 
For example, an application instantiates a new SIP connection by calling
 &lt;code&gt;Connector.open()&lt;/code&gt;, which will return either a &lt;code&gt;SipClientConnection&lt;/code&gt; or a &lt;code&gt;SipServerConnection&lt;/code&gt;, depending on the SIP URI passed to &lt;code&gt;open()&lt;/code&gt;. Your application should call the &lt;code&gt;Connector.close()&lt;/code&gt; method when it has finished with the connection.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The SIP URI has the following syntax...
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;code&gt;{scheme}:[{target}][{params}]&lt;/code&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
...where: 
&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;scheme&lt;/code&gt; is the SIP scheme supported by the system, &lt;code&gt;sip&lt;/code&gt; or &lt;code&gt;sips&lt;/code&gt;. In the &lt;code&gt;sips&lt;/code&gt; protocol, the server connection accepts only requests over secure transport, as defined in the RFC 3261 standard.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;target&lt;/code&gt; is the user address, which can be something like &lt;code&gt;userName@target-host.com:portNumber&lt;/code&gt; or just a phone number.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;params&lt;/code&gt; represents additional parameters; for example, &lt;code&gt;transport=udp&lt;/code&gt; to specify UDP as the transport protocol.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
If the &lt;code&gt;target&lt;/code&gt; host is included, a new client connection is opened; if it&#39;s not, a new server connection is opened. Here are some examples:
&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;10&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre&gt;...
// client connections
SipClientConnection scc = (SipClientConnection)
    Connector.open(&quot;sip:max@company.com&quot;);
SipClientConnection scc2 = (SipClientConnection)
    Connector.open(&quot;sip:jack@128.11.1.2:5100&quot;);
...

...
// server connection
SipConnectionNotifier scn = (SipConnectionNotifier)
    Connector.open(&quot;sip:5500&quot;);
...

...
// server connection where the port number is allocated by the system
SipConnectionNotifier scn2 = (SipConnectionNotifier)
    Connector.open(&quot;sip:&quot;);
...
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;sp20&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;
 
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The following method demonstrates how to open a SIP client connection to
 a server that&#39;s running on host 102.12.1.1 and listening on port 5050.
&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;10&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre&gt;private void sendMessage(String message) {
    SipClientConnection sc = null;
    try {
        // open SIP connection to server 102.12.1.1 on port 5050
        sc = (SipClientConnection)
            Connector.open(sip:user@102.12.1.1:5050);
        // initialize SIp request MESSAGE
        sc.initRequest(&quot;MESSAGE&quot;, null);
        // set the message header
        sc.setHeader(&quot;Subject&quot;, subject.getString());
        sc.setHeader(&quot;Content-Type&quot;, &quot;text/plain&quot;);
        sc.setHeader(&quot;Content-Length&quot;, &quot;&quot;+text.length());
        // send the message to the network
        OutputStream os = sc.openContentOutputStream();
        os.write(message.getBytes());
        os.close(); // close the connection
    } catch(Exception ex) {
        ex.printStackTrace();
    }
}
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;sp20&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;
 
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The next code segment implements the &lt;code&gt;notifyRequest()&lt;/code&gt; method of the &lt;code&gt;SipServerConnectionListener&lt;/code&gt; interface. When the server receives the initialization SIP request &lt;code&gt;MESSAGE&lt;/code&gt;, it retrieves the headers of the message and its content, then sends a response back to the client.  
&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;10&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre&gt;public void notifyRequest(SipConnectionNotifier scn) {
   try {
      ssc = scn.acceptAndOpen();
      if(ssc.getMethod().equals(&quot;MESSAGE&quot;)) {
         String contentType = ssc.getHeader(&quot;Content-Type&quot;);
         String contentLength = ssc.getHeader(&quot;Content-Length&quot;);
         int length = Integer.parseInt(contentLength);
         if((contentType != null) &amp;amp;&amp;amp; contentType.equals(&quot;text/plain&quot;)) {
            InputStream is = ssc.openContentInputStream();
            int i=0;
            byte testBuffer[] = new byte[length];
            i = is.read(testBuffer);
            String tmp = new String(testBuffer, 0, i); 
               // the message received
         }
         ssc.initResponse(200); // OK
         ssc.send();
      }    
   } catch(IOException ex) {
      // ex.getMessage();
   }
}
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;sp20&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Programming SIP MIDlets&lt;/b&gt;&lt;/div&gt;
&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;contentdivider&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot; &quot; border=&quot;0&quot; height=&quot;4&quot; src=&quot;http://developers.sun.com/im/a.gif&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
A good way to learn how to develop SIP MIDlets is by adapting existing MIDlets. &lt;code&gt;SipMIDlet&lt;/code&gt;,
 which comes with the reference implementation, shows how to open a 
connection to a SIP server, send messages, and receive replies:
&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;10&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;pre&gt;import java.util.*;
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

import javax.microedition.sip.*;

public class SipMIDlet extends MIDlet
    implements CommandListener, SipServerConnectionListener  {

    private Display display;
    private long startTime;
    private Form form;
    private TextField receivePort;
    private Command receiveCmd;
    private Command exitCmd;
    SipConnectionNotifier scn = null;
    SipServerConnection ssc = null;

    public SipMIDlet() {
        System.out.println(&quot;MIDlet: SipMIDlet starting...&quot;);
        display=Display.getDisplay(this);
        form = new Form(&quot;Receive Message&quot;);
        receivePort = new TextField
            (&quot;Give receive port:&quot;, &quot;sip:5060&quot;, 30,
            TextField.LAYOUT_LEFT);
        form.append(receivePort);
        receiveCmd = new Command(&quot;Start&quot;, Command.ITEM, 1);
        exitCmd = new Command(&quot;Exit&quot;, Command.EXIT, 1);
        form.addCommand(receiveCmd);
        form.addCommand(exitCmd);
        form.setCommandListener(this);
    }
    
    public void commandAction(Command c, Displayable d) {
        if(c == receiveCmd) {
            Thread t = new Thread() {
                public void run() {
                receiveMessage();
                }
            };
            t.start();
        }
        if(c == exitCmd) {
            if(scn != null) {
                try {
                    scn.close();
                }
                catch(IOException iox) {
                }
            }
            destroyApp(true);
        }
    } 
    
    public void startApp() {
        display.setCurrent(form);    
        System.out.println(&quot;MIDlet: SipMIDlet startApp()&quot;);
    }
    
    public void receiveMessage() {
        try {
            if(scn != null)
            scn.close();
            scn = (SipConnectionNotifier)
                Connector.open(receivePort.getString());
            scn.setListener(this);
            form.append(&quot;Listening... in port: &quot;+scn.getLocalPort());
        } catch(Exception ex) {
            ex.printStackTrace();
        }
    }
    
    public void notifyRequest(SipConnectionNotifier scn) {
        try {
            ssc = scn.acceptAndOpen();
            if(ssc.getMethod().equals(&quot;MESSAGE&quot;)) {
            String contentType = ssc.getHeader(&quot;Content-Type&quot;);
            String contentLength = ssc.getHeader(&quot;Content-Length&quot;);
            int length = Integer.parseInt(contentLength);
            if((contentType != null) &amp;amp;&amp;amp;
                contentType.equals(&quot;text/plain&quot;)) {
                InputStream is = ssc.openContentInputStream();
                int i=0;
                byte testBuffer[] = new byte[length];
                i = is.read(testBuffer);

                String tmp = new String(testBuffer, 0, i);

                StringItem st = new StringItem
                    (&quot;Subject:&quot;, ssc.getHeader(&quot;Subject&quot;));
                form.append(st);
                st = new StringItem(&quot;Message:&quot;, tmp);
                form.append(st);
            }
            ssc.initResponse(200);
            ssc.send();
        }
        
        } catch(IOException ex) {
            form.append(&quot;Exception: &quot;+ex.getMessage());
        }
    
    }
    
    public void pauseApp() {
        System.out.println(&quot;MIDlet: pauseApp()&quot;);
    }

    public void destroyApp(boolean b) {
        System.out.println(&quot;MIDlet: destroyApp()&quot;);
        notifyDestroyed();
    }   
}
&lt;/pre&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;sp20&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/span&gt;
 
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Using the J2ME Wireless Toolkit to Develop SIP MIDlets&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;contentdivider&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot; &quot; border=&quot;0&quot; height=&quot;4&quot; src=&quot;http://developers.sun.com/im/a.gif&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The easiest way to build SIP MIDlets is to use the J2ME Wireless Toolkit. Note that even the latest release of the toolkit, version 2.2,
 doesn&#39;t support SIP APIs for J2ME and therefore can&#39;t actually run 
MIDlets that use them. You can, however, configure the Wireless Toolkit 
so that it can &lt;i&gt;build&lt;/i&gt; MIDlets that use the SIP APIs for J2ME, then &lt;i&gt;test&lt;/i&gt; the MIDlets in the Nokia emulator that comes with the JSR 180 RI. This section shows you how.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Once you have J2ME Wireless Toolkit 2.2 installed, the key task is to 
copy the SIP APIs that come with the Nokia reference implementation into
 the toolkit&#39;s &lt;code&gt;midp20api.jar&lt;/code&gt; file. Use your favorite archiving tool; for example, many Windows users would use WinZip, thus:
&lt;/div&gt;
&lt;ol&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;In WinZip, open &lt;code&gt;/&amp;lt;pathToSIPROOT&amp;gt;/lib/sipa1_0.jar&lt;/code&gt;.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;In a second WinZip window, open &lt;code&gt;/&amp;lt;wtk22&amp;gt;/lib/midp20.jar&lt;/code&gt;.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Drag and drop the classes from &lt;code&gt;sipa1_0.jar&lt;/code&gt; to &lt;code&gt;midpapi20.jar&lt;/code&gt;.&lt;/li&gt;
&lt;li style=&quot;text-align: justify;&quot;&gt;Close both archives.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Now run the J2ME Wireless Toolkit. Create a project to build &lt;code&gt;SipMIDlet&lt;/code&gt;, and call it whatever you like&amp;nbsp;– &lt;code&gt;MySIP&lt;/code&gt;
 in my example. Because you cannot run the SIP MIDlet in the toolkit&#39;s 
emulator, and the RI&#39;s emulator supports only CLDC 1.1 and MIDP 2.0, you
 should configure the project settings as in this dialog:
&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;1&quot; cellspacing=&quot;0&quot; style=&quot;text-align: center; width: 154px;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;grey3&quot;&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;span class=&quot;sp20&quot;&gt; &lt;/span&gt;
 
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Other SIP-related JSRs&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;contentdivider&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot; &quot; border=&quot;0&quot; height=&quot;4&quot; src=&quot;http://developers.sun.com/im/a.gif&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
Within the JCP, a number of JSRs have resulted in standard SIP APIs: JAIN SIP API Specification (JSR 32) specifies a standard interface to share information between SIP clients and SIP servers. SIP Servlet API
 (JSR 116) defines a high-level extension interface to enable SIP 
servers to deploy and manage SIP applications based on the servlet 
model. Finally, JSR 180 defines a general SIP API for J2ME clients, to 
make it possible for SIP applications to run in devices with limited 
memory.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;b&gt;Conclusion&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;contentdivider&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;grey4&quot; style=&quot;text-align: justify;&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;img alt=&quot; &quot; border=&quot;0&quot; height=&quot;4&quot; src=&quot;http://developers.sun.com/im/a.gif&quot; width=&quot;1&quot; /&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
The SIP protocol was designed with the Internet in mind. With its 
request-response model, it resembles HTTP and other Internet protocols. 
As a result, telephony simply becomes another web application that can 
be integrated into other applications and services easily. Compared to 
legacy mobile-network protocols, SIP is easy to program to, so it will 
become an important tool for establishing communication sessions. It can
 be used to implement all kinds of peer-to-peer applications that 
feature voice, video, messaging, and gaming.
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
This article presented an overview of SIP, and a tutorial on SIP API for
 J2ME. The sample code showed how little effort is required to develop 
SIP applications; there&#39;s only a handful of classes and interfaces you 
need to learn about to get started. Following the instructions in this 
article, you should find it easy to configure your J2ME Wireless Toolkit
 to serve as your development environment for SIP MIDlets.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/6068908036422206591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-implement-internet-calling-in.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6068908036422206591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6068908036422206591'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-implement-internet-calling-in.html' title='java 2 micro edition tutorial of Internet Calling using SIP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-6434324494857873366</id><published>2012-06-10T03:52:00.003-07:00</published><updated>2012-06-14T00:29:02.903-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Downloads"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="statement"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>how to use Extending Objects in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Many times you need to create an object that is almost like an existing object but with slight&amp;nbsp;differences. In this situation, you can extend the existing object. When you extend an object, you&amp;nbsp;inherit all of its members marked as public (unless you choose to override them). You can also add&amp;nbsp;new public members. In addition, your new class can access items in the original class marked as&amp;nbsp;protected (but not private).&lt;br /&gt;
&lt;br /&gt;
For example, suppose the simple class from the last example (T) is almost what you need, but you&amp;nbsp;want another method to print the string in uppercase. You can write:&lt;br /&gt;
&lt;br /&gt;
class Tupper extends T&lt;br /&gt;
{&lt;br /&gt;
public Tupper(String s)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;{&lt;br /&gt;
super(s); // chain constructor&lt;br /&gt;
}&lt;br /&gt;
public void printMsgUpper()&lt;br /&gt;
{&lt;br /&gt;
System.out.println(msg.toUpperCase());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
In this case, you say that class Tupper extends T. That makes T the base class for Tupper , and&amp;nbsp;Tupper derives from T.&lt;br /&gt;
&lt;br /&gt;
This new class is just like T but includes an extra method. The Tupper class has the same members&amp;nbsp;as the T class (except for the constructor). Notice that each class must provide its own constructors&amp;nbsp;(unless the base class has a default constructor).&lt;br /&gt;
&lt;br /&gt;
You could just as easily replace printMsg with a new version instead of creating a new method. For&amp;nbsp;example:&lt;br /&gt;
&lt;br /&gt;
class Tupper extends T&lt;br /&gt;
{&lt;br /&gt;
public Tupper(String s)&lt;br /&gt;
{&lt;br /&gt;
super(s); // chain constructor&lt;br /&gt;
}&lt;br /&gt;
public void printMsg()&lt;br /&gt;
{&lt;br /&gt;
System.out.println(msg.toUpperCase());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The super keyword refers to the base class. As a special case, you can use this keyword as the first&amp;nbsp;line in a constructor to call a particular constructor in the base class. You can also use this keyword&amp;nbsp;anywhere in any method to access methods in the base class. For example:&lt;br /&gt;
&lt;br /&gt;
public void printMsg()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
super.printMsg();&lt;br /&gt;
System.out.println(msg.toUpperCase());&lt;br /&gt;
}&lt;br /&gt;
This is a good example of polymorphism. Consider this main method:&lt;br /&gt;
public static void main(String [] args)&lt;br /&gt;
{&lt;br /&gt;
T test = new Tupper(&quot;Black Book&quot;);&lt;br /&gt;
test.printMsg();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/6434324494857873366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-extending-objects-in-java.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6434324494857873366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6434324494857873366'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-extending-objects-in-java.html' title='how to use Extending Objects in java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-6441766693891926586</id><published>2012-06-10T03:46:00.003-07:00</published><updated>2012-06-14T00:29:02.908-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="operators"/><category scheme="http://www.blogger.com/atom/ns#" term="statement"/><title type='text'>how to use throw Statement in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
A throw statement forces an exception. This transfers control to the next try-catch statement that&amp;nbsp;matches the object named in the throw statement. The following code shows you how to use it:&lt;br /&gt;
&lt;br /&gt;
throw e; //e is a class derived from Throwable&amp;nbsp;Executing a throw statement exits the enclosing block. Here&#39;s an example:&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
return cons.newInstance(new Object[] { string });&lt;br /&gt;
} catch (Throwable ex)&lt;br /&gt;
{&lt;br /&gt;
throw new ParseException(&quot;Error creating instance&quot;, 0);&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/6441766693891926586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-throw-statement-in-java.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6441766693891926586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6441766693891926586'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-throw-statement-in-java.html' title='how to use throw Statement in java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-6600552555495606720</id><published>2012-06-10T03:44:00.001-07:00</published><updated>2012-06-14T00:29:02.917-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="statement"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>how to use try-catch-finally Statement in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
You can add a finally block to a try block. When the block under the try statement exits for any&amp;nbsp;reason (including a normal exit), the finally block executes.&lt;br /&gt;
&lt;br /&gt;
The following is an adaptation from a finally statement used in Java&#39;s Timer class:&lt;br /&gt;
&lt;br /&gt;
public void run()&lt;br /&gt;
{&lt;br /&gt;
try&lt;br /&gt;
{&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
mainLoop();&lt;br /&gt;
} finally&lt;br /&gt;
{// Dead Thread, behave as if Timer cancelled&lt;br /&gt;
synchronized(queue)&lt;br /&gt;
{&lt;br /&gt;
newTasksMayBeScheduled = false;&lt;br /&gt;
queue.clear(); // Eliminate obsolete references&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/6600552555495606720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-try-catch-finally-statement.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6600552555495606720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/6600552555495606720'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-try-catch-finally-statement.html' title='how to use try-catch-finally Statement in java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-4737325918110144524</id><published>2012-06-10T03:42:00.002-07:00</published><updated>2012-06-14T00:29:02.860-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="keywords"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="statement"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>how to use return statement in java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Use return to terminate the current method. The return statement terminates a method and&amp;nbsp;(optionally) sends back a value to the calling statement. You&#39;ll see more about the returnType&amp;nbsp;method when you start to write your own methods.&lt;br /&gt;
&lt;br /&gt;
The following program computes the length of the hypotenuse of a right triangle, where the sides of&amp;nbsp;the triangle are side_1 and side_2 . The return statement returns the length as a double data type:&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
static double computePythagorus(double side_1, double side_2)&lt;br /&gt;
{&lt;br /&gt;
double hypotenuse = 0D;&lt;br /&gt;
hypotenuse = Math.sqrt(side_1 * side_2 + side_2 * side_2);&lt;br /&gt;
return hypotenuse;&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/4737325918110144524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-return-statement-in-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4737325918110144524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/4737325918110144524'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-return-statement-in-java.html' title='how to use return statement in java'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-5654770851899692490</id><published>2012-06-09T01:28:00.003-07:00</published><updated>2012-06-14T00:29:02.884-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="statement"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>How to use break and continue statement in java?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Using the break Statement:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
The break statement is used to exit a block contained within a switch, while, do, or for statement. By&lt;br /&gt;
default, execution continues after the controlling statement. For example, this loop will exit if the loop&lt;br /&gt;
variable becomes negative:&lt;br /&gt;
&lt;br /&gt;
for (;i==5;i--)&lt;br /&gt;
{&lt;br /&gt;
if (i&amp;lt;0) break;&lt;br /&gt;
// other statements here&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
Presumably, this break statement will prevent the problem in which i was less than 5 already. When i&lt;br /&gt;
becomes negative, the break statement will cause Java to stop executing the loop.&lt;br /&gt;
&lt;br /&gt;
You can also break out of multiple loops by using a label (see the &quot;Using Labeled Statements&quot;&lt;br /&gt;
section).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Using the continue Statement:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
The continue statement is used to skip the current iteration of a for , while, or do loop. When Java&lt;br /&gt;
encounters a continue statement, it short-circuits the current loop and moves to the next iteration.&lt;br /&gt;
&lt;br /&gt;
For example, consider this loop:&lt;br /&gt;
&lt;br /&gt;
for (int i=1;i&amp;lt;=3;i++)&lt;br /&gt;
{&lt;br /&gt;
if (i==2) continue;&lt;br /&gt;
System.out.println(i);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
This loop will print only 1 and 3. When i is 2, the continue statement causes the loop to skip that&lt;br /&gt;
iteration.&lt;br /&gt;
&lt;br /&gt;
Sometimes when multiple loops are nested, you&#39;ll want to continue an outer loop from within an inner&lt;br /&gt;
loop. You can do that with labels.&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/5654770851899692490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-break-and-continue-statement.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/5654770851899692490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/5654770851899692490'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-break-and-continue-statement.html' title='How to use break and continue statement in java?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-7333807722065574495</id><published>2012-06-09T01:24:00.003-07:00</published><updated>2012-06-14T00:29:02.929-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="classes"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="j2me"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="keywords"/><category scheme="http://www.blogger.com/atom/ns#" term="Objects"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="statement"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>how to use the for loop or statement in java?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
You should use the for statement when you have a definite number of times you want to execute a&lt;br /&gt;
loop. This statement includes three sections: initialization, condition, and update. A for statement&lt;br /&gt;
should have the following form:&lt;br /&gt;
&lt;br /&gt;
for (initialization; condition; update)&lt;br /&gt;
{&lt;br /&gt;
statements;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
When Java first encounters a for statement, it executes the initialization clause. This can set an&lt;br /&gt;
initial value for a loop variable (i=0, for example), or you can declare a unique variable for the loop and&lt;br /&gt;
initialize it (int i=0). If you declare a variable here, its scope is just the body of the loop.&lt;br /&gt;
&lt;br /&gt;
The next step is to evaluate the condition expression. If the condition is false, the loop does not&lt;br /&gt;
execute. Java repeats this test when the loop repeats.&lt;br /&gt;
&lt;br /&gt;
If the body of the loop executes, the update clause evaluates at the end of the block, and then Java&lt;br /&gt;
tries the condition expression again. If the condition is true, the block repeats. If the expression is&lt;br /&gt;
false, the loop is over; Java skips the block and continues execution. This loop will print the numbers 1&lt;br /&gt;
to 10 on the console:&lt;br /&gt;
&lt;br /&gt;
for (int i=1; i&amp;lt;=10; i++) System.o ut.println(i);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following program demonstrates using a for loop to march through the characters of a string to&lt;br /&gt;
build a hash value for the string:&lt;br /&gt;
&lt;br /&gt;
public class stringHashCode&lt;br /&gt;
{&lt;br /&gt;
public static void main(String[] args)&lt;br /&gt;
{&lt;br /&gt;
String stringToHash = args[0];&lt;br /&gt;
char stringChar[] = stringToHash.toCharArray();&lt;br /&gt;
int hashcode = 0, count = 0;&lt;br /&gt;
int len = stringToHash.length();&lt;br /&gt;
for (int index = 0; index &amp;lt; len; index++)&lt;br /&gt;
{&lt;br /&gt;
hashcode = 31*hashcode + stringChar[count++];&lt;br /&gt;
}&lt;br /&gt;
String output = &quot;Hashcode for &quot; + stringToHash +&lt;br /&gt;
&quot; = &quot; + stringToHash.hashCode() + &quot;\n&quot;;&lt;br /&gt;
output += &quot;Java native hashcode = &quot; + hashcode + &quot;\n&quot;;&lt;br /&gt;
output += &quot; our hashcode = &quot; + hashcode ;&lt;br /&gt;
System.out.println( output );&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//returns:&lt;br /&gt;
//Hashcode for john = 3267851&lt;br /&gt;
//Java native hashcode = 3267851&lt;br /&gt;
// our hashcode = 3267851&lt;br /&gt;
&lt;br /&gt;
You don&#39;t have to specify all three parts of the for loop if you don&#39;t want to. For example, if the loop is&lt;br /&gt;
already initialized, you can omit the initialization clause:&lt;br /&gt;
&lt;br /&gt;
for (;i&amp;lt;10;i++) . . .&lt;br /&gt;
&lt;br /&gt;
Of course, that assumes that i and any other variables you need are already set before you enter the&lt;br /&gt;
loop. You can even omit all three clauses if you want to loop forever (or until a break statement&lt;br /&gt;
occurs, which is the topic of the next section):&lt;br /&gt;
&lt;br /&gt;
for (;;;) go(); // execute forever.&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/7333807722065574495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-for-loop-or-statement-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/7333807722065574495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/7333807722065574495'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/how-to-use-for-loop-or-statement-in.html' title='how to use the for loop or statement in java?'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3728070035494902299.post-8992389181675321645</id><published>2012-06-09T01:22:00.002-07:00</published><updated>2012-06-14T00:29:02.955-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="conditional"/><category scheme="http://www.blogger.com/atom/ns#" term="exercise"/><category scheme="http://www.blogger.com/atom/ns#" term="java 2 micro edition"/><category scheme="http://www.blogger.com/atom/ns#" term="java buzzwords"/><category scheme="http://www.blogger.com/atom/ns#" term="jexpert"/><category scheme="http://www.blogger.com/atom/ns#" term="jinfo"/><category scheme="http://www.blogger.com/atom/ns#" term="materials"/><category scheme="http://www.blogger.com/atom/ns#" term="OOP"/><category scheme="http://www.blogger.com/atom/ns#" term="operators"/><category scheme="http://www.blogger.com/atom/ns#" term="tutorial"/><title type='text'>in java Replacing if with the Conditional Operator</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;Conditional Operator?:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
It is very common to use an if statement to set a variable to one of two values based on some logical&lt;br /&gt;
expression. For example:&lt;br /&gt;
&lt;br /&gt;
if (firstValue &amp;lt; secondValue)&lt;br /&gt;
{&lt;br /&gt;
minimumValue = firstValue;&lt;br /&gt;
} else&lt;br /&gt;
{&lt;br /&gt;
minimumValue = secondValue;&lt;br /&gt;
}&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This construction is used so often that Java has a shortcut notation for it. The shortcut is called the&lt;br /&gt;
conditional operator , having the fo rm:&lt;br /&gt;
&lt;br /&gt;
answer = (expression) ? returnThisIfTrue : returnThisIfFalse;&lt;br /&gt;
&lt;br /&gt;
The expression must return a boolean value. The returnThisIfTrue and returnThisIfFalse&lt;br /&gt;
expressions must yield a value of the same data type as the answer variable. We can replace the&lt;br /&gt;
previous if statement with a conditional operator:&lt;br /&gt;
&lt;br /&gt;
minimumValue =&amp;nbsp;(firstValue &amp;lt; secondValue) ? firstValue : secondValue;&lt;br /&gt;
&lt;br /&gt;
The following example is adapted from Java&#39;s Short class. A string is converted to a short integer by&lt;br /&gt;
using one procedure for a positive number and another procedure for a negative number:&lt;br /&gt;
&lt;br /&gt;
shortValue = negative ?&amp;nbsp;new Short((short)-inputString.shortValue()) :&amp;nbsp;new Short((short)inputString.shortValue());&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jexpertize.blogspot.com/feeds/8992389181675321645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jexpertize.blogspot.com/2012/06/in-java-replacing-if-with-conditional.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/8992389181675321645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3728070035494902299/posts/default/8992389181675321645'/><link rel='alternate' type='text/html' href='http://jexpertize.blogspot.com/2012/06/in-java-replacing-if-with-conditional.html' title='in java Replacing if with the Conditional Operator'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/07744053424058186717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>