J2ME

J2ME Projects

J2ME Project 1

J2ME Subjective Questions And Answers
More interview questions and answers

What is J2ME?

The J2ME stands for Java Micro Edition , it\'s Mobility Java ME (formerly J2ME) technologies contain a highly optimized Java Runtime Environment, and it\'s that specifically addresses the vast consumer space. Java ME technologies cover a wide range of extremely tiny commodities, and enable security, connectivity, and useful utility programs inside smart cards, pagers, set-top boxes, and other small appliances. Java ME technologies are only one part of the Java software product family. Related Java platforms include the Java Platform, Standard Edition (Java SE, formerly J2SE platform), and the Java Platform, Enterprise Edition (Java EE, formerly J2EE platform). Java technology also provides ways to create Web services, XML information transfers, numerous networking protocols, toolkit, and the Java Web Start application. 


Why we use J2ME?

Java 2 Micro Edition (J2ME) is Sun\'s version of Java aimed at machines with limited hardware resources such as PDAs, cell phones, and other consumer electronic and embedded devices. J2ME is aimed at machines with as little as 128KB of RAM and with processors a lot less powerful than those used on typical desktop and server machines. J2ME actually consists of a set of profiles. Each profile is defined for a particular type of device -- cell phones, PDAs, microwave ovens, etc. -- and consists of a minimum set of class libraries required for the particular type of device and a specification of a Java virtual machine required to support the device.


What is advantage of J2ME?

The J2ME architecture had to be modular and scalable due to the diversity of target devices. To achieve this, J2ME provides a range of virtual machines, each optimized to the different processor types and memory footprints.

J2ME advantages include improved security and consistency of applications across platforms and devices, superior user interfaces with graphics, the ability to function off-line out of wireless coverage, peer-to-peer networking and no licensing expenses needed for the SDK, which means that anyone can create an application and market it.


What is disadvantage of J2ME?

Disadvantage of J2ME

1. Midlet application will never mess up another application on the same device or the device OS itself.

2. Unlike the J2SE, J2ME devices dont have a command prompt.

3. A midlet application invoke in different manner as J2SE because it control by Application Management Software(AMS).

4. AMS interacts with native operations of a Midlet application and controls its life cycle. It is responsible for starting, processing, stoping and destory a Midlets application executions.

5. It have memory is very limited, so operating speed is relatively slow.

6. As J2SE application used data persistence, J2ME is done through the Record Management System (RMS), which operates solely on byte arrays. but it provide a security lake.

7. Unlike J2SE, J2ME device does not support full size keyboard specially alphanumeric sequences.

What is Generic\" J2ME architecture?

The J2ME is using the configure and profiles to customize the Java Runtime Environment (JRE). In a complete JRE, J2ME is comprised of a configuration, and which determines the JVM used, and a profile, which defines the application by adding domain-specific classes. The configuration defines the basic run-time environment as a set of core classes and a specific JVM that run on specific types of devices. The profile defines the application; specifically, it adds domain-specific classes to the J2ME configuration to define certain uses for devices. The following graphic depicts the relationship between the different virtual machines, configurations, and profiles. It also draws a parallel with the J2SE API and its Java virtual machine. While the J2SE virtual machine is generally referred to as a JVM, the J2ME virtual machines, KVM and CVM, are subsets of JVM. Both KVM and CVM can be thought of as a kind of Java virtual machine , it\'s just that they are shrunken versions of the J2SE JVM and are specific to J2ME.

Define MID Profile Layer.

Profiles layer based on a configuration and additional API\'s for user interface, persistent storage and factors necessary for developing wireless applications.

Mobile Information Device (MIDP) Profile -  MIDP is specification published for the use of Java, mobile devices, and embedded system. It is a part of Java Micro Edition (Java ME) framework and top of a Connected Limited Device Configuration (CLDC). Its provides a standard platform for small, resource-limited, and wireless-connected mobile information devices. MIDP requires CLDC for implementation.

Personal Digital Assistance (PDAP) Profile - PDAP is specifically designed for Palmtop or similar devices with limited power, typical battery operated, user interface displays like a pointing device and character input, with minimum of 512kb (and maximum 16MB) combined ROM (read only memory) and RAM (random access memory) hardware.

Personal Profile -  Personal profile specification repacks the Personal Java APIs Environment to provide J2ME specification for devices that need a high degree of Internet connectivity. This profile builds on top of foundation profile.

Personal Basic Profile - This profile is intended to provide basic Graphical User Interface (GUI) capabilities to devices where the high-fidelity, feature-rich Personal Profile is not fully utilized or necessary means which running the CDC and Foundation Profile.

Remote Method Invocation (RMI) Profile -  RMI profile also builds on top of Foundation profile and supports inter-application RMI over TCP/IP connections for applications written to the Foundation Profile. It\'s provides the infrastructure to marshal objects as the parameters and return values of remote method calls while the dynamic class loading is utilized to make the marshalled objects available to a particular JVM during a remote call.

Foundation Profile -  The Foundation profiles specified for devices that can support a rich networked J2ME environment. It provides services for other device-specific profiles (such as Personal profile and RMI profile) to be layered on top of it. This profile specific design for CDC profiles that provide Graphical User Interface (GUI), Data storage, and distribution of java networking. 

Will J2SE applications run on J2ME?If Not Why?

No,

The Midlet applications API can divided into J2ME is divided into Configurations, Profiles, and Optional APIs packages.

1. Configuration describes a set of APIs, mostely subset of J2SE APIs, this subset include fundamental packages like java.lang( Object classes), java.io (Stream classes), java.util (collection classes).

2. Profile is more specific and subsets of configuration, a profile usually include a set of  basic APIs for application life cycle, user interface, and persistent storage.

3. Optional APIs define specific additional functionality that may be include in a particular configuration or profile.

Since Midlet is have subset of J2SE API so it won\'t support most of classes define into J2SE package. therefore J2SE application won\'t run into J2ME device.

Will J2ME applications run on J2SE?

No,

Since J2ME uses subset of J2SE API. Many classes have been remove to keep the J2ME platform flexible, efficient and smaller. Consider a example, many small device won\'t support Abstract Window Toolkit (AWT), means device don\'t have screen capability to provide drop down menus and button.  

What is minimum hardware and Software requirements for J2ME?

J2ME design for target small device that have less than 512 KB of memory. Small devices range in size from pagers, mobile phones, Smartphone, personal digital assistants (PDAs), and set-top boxes.

Explain Virtual Machine for J2ME?

In J2ME using K virtual machine and The K Virtual Machine (KVM), a key feature of the J2ME architecture, is a highly portable Java virtual machine designed from the ground up for smallmemory,limited-resource, network-connected devices such as cellular phones,pagers, and personal organizers. These devices typically contain 16- or 32-bitprocessors and a minimum total memory footprint of approximately 128

kilobytes. However, the KVM can be deployed flexibly in a wide variety of devices appropriate for various industries and the large range of trade-offs among processor power, memory size, device characteristics, and application

functionality they engender.

What is difference between J2ME and J2SE?

J2SE is the Java 2 Standard Edition that contains your basic core Java classes. This is the one that most people use to write your standard applets and applications.

J2ME is for developers that code to portable devices, such as a palm pilot or a cellular phone. Code on these devices needs to be small in size and take less memory. So you will want to use J2ME if you code for a PDA.

J2SE stands for Java 2 standard edition and is normally for developing desktop applications, forms the core/base API.

J2ME stands for Java 2 micro edition for applications which run on resource constrained devices (small scale devices) like cell phones, for example games.


What is Class File Verification?

Class File verification is used by Java Virtual Machine (JVM) before full startup of the JVM occurs in running bytecode of an application. This can be done in four Passes- 

Pass-1:- Check byte code attributes, magic number, constant pool must not have any superficial data, and class file must not have extra bytes at end.

Pass-2:- Check every class behaviour and attribute and every class has valid names, classes, descriptor, and packages.

Pass-3:- Check code linking, attribute, and analysis data flow.

Pass-4:- Check where class loading occurs to finalize the class verification process.

Give me name of 10 classes of J2SE which are not used in J2ME.

1. javax.microedition.midlet.MIDlet class - A MIDlet is a MID Profile application.A MIDlet is a set of classes designed to be run and controlled by the application management software via this interface. 

2. javax.microedition.lcdui.Alert class -An Alert is a Screen that is used to display information about the event to the user for a certain period of time. 

3. javax.microedition.lcdui.Canvas class -  Class is used to handel low-level event and represent the graphics issue for drawing.

4. javax.microedition.lcdui.ChoiceGroup class - Class is used to represents a group of selectable elements .

5. javax.microedition.lcdui.Command class - Class is used to encapsulates the semantic information of an action. This Action invoke a CommandListner that associated with the Displayable.

6. javax.microedition.lcdui.CustomItem class - Class is used to add new visual and interactive elements into Forms.

7. javax.microedition.lcdui.DateField class - Class is used to represent date and time (calendar) information.

8. javax.microedition.lcdui.Display class - Class is used to represents the display manager and input device of system. 

9. javax.microedition.lcdui.Form class - Class is used to create a Form on screen contains an arbitrary mixture of items: TextField, TextBox, Images, DataFields, Gauges, Choice Groups, and Coustom items.

10. javax.microedition.lcdui.Screen class - Class is used to implements a graphical display, such as a a bar graph.

List some Property Supported by J2ME?

1. No authorizing costs required for the SDK

2. Better client interfaces with graphics 

3. The proficiency to function off-line out of wireless treatment

4. Introduced advanced security 

5. Submissions over stages and apparatus consistently 

6. Peer-to-peer networking 


Explain K Virtual Machine and its architecture?

The K virtual machine (KVM) is Sun\'s newest Java virtual machine technology and is designed for products with approximately 128K of available memory. The KVM fills a very important role in Sun\'s Java virtual machine product offerings, and will form a part of a completely new Java runtime environment. This environment is highly optimized for small-memory limited-resource connected devices such as cellular phones, pagers, PDAs, set-top boxes, and point-of-sale terminals.

The KVM evolved from a research project at Sun Laboratories. It is a derivative of The Java Virtual Machine Specification, written from scratch in C, with special emphasis in these key areas:

1.Optimized for small size

2.Easily portable to different platforms

3.Modular and extensible

4.Source code base written from scratch

5.As \"complete\" and \"fast\" as possible without significantly increasing footprint.

What is profile and configurations?

Profile is more specific and subsets of configuration, a profile usually include a set of basic APIs for application life cycle, user interface, and persistent storage, to make a complete environment for building complex applications.

Configuration is designed for a specific kind of device based on memory constraints and processor power. A Configuration describes a set of APIs, Java Virtual Machine and library, but it does not capable itself  for provide enough detail to developer for building complete applications. It also use subset of Java 2 Platform, Standard Edition(J2SE) APIs that will used on platform, as well as add additional APIs that may be necessary.

What hardware and software requirements of a device that intends to implement the MIDP.

J2ME design for target small device that have less than 512 KB of memory. Small devices range in size from pagers, mobile phones, Smartphone, personal digital assistants (PDAs), and set-top boxes.

What is MID Profile Architecture?

Profile Layer -  Profiles layer based on a configuration and additional APIs for user interface, persistent storage and factors necessary for developing wireless applications.

 

Mobile Information Device (MIDP) Profile -  MIDP is specification published for the use of Java, mobile devices, and embedded system. It is a part of Java Micro Edition (Java ME) framework and top of a Connected Limited Device Configuration (CLDC). Its provides a standard platform for small, resource-limited, and wireless-connected mobile information devices. MIDP requires CLDC for implementation.

Personal Digital Assistance (PDAP) Profile - PDAP is specifically designed for Palmtop or similar devices with limited power, typical battery operated, user interface displays like a pointing device and character input, with minimum of 512kb (and maximum 16MB) combined ROM (read only memory) and RAM (random access memory) hardware.

Personal Profile -  Personal profile specification repacks the Personal Java APIs Environment to provide J2ME specification for devices that need a high degree of Internet connectivity. This profile builds on top of foundation profile.

Personal Basic Profile - This profile is intended to provide basic Graphical User Interface (GUI) capabilities to devices where the high-fidelity, feature-rich Personal Profile is not fully utilized or necessary means which running the CDC and Foundation Profile.

Remote Method Invocation (RMI) Profile -  RMI profile also builds on top of Foundation profile and supports inter-application RMI over TCP/IP connections for applications written to the Foundation Profile. It\'s provides the infrastructure to marshal objects as the parameters and return values of remote method calls while the dynamic class loading is utilized to make the marshalled objects available to a particular JVM during a remote call. A special type of protocol - wire protocol JRMP (Java Remote Method Protocol) is required for supported.

Foundation Profile -  The Foundation profiles specified for devices that can support a rich networked J2ME environment. It provides services for other device-specific profiles (such as Personal profile and RMI profile) to be layered on top of it. This profile specific design for CDC profiles that provide Graphical User Interface (GUI), Data storage, and distribution of java networking. 


What is MIDlet ?

MIDlets are J2ME optimized servlet API and architecture-based applications for wireless Java enabled devices such as PDA, cell phones and the RIM BlackBerry. Applications range from calendar contact managers to simple games. For more on MIDlets and how they\'re developed and applied. 

Explain MIDlet Life cycle?

The MIDlet lifecycle is the fundamental for creation of any MIDlet. The lifecycle includes the execution states such as creation, start, pause and exiting operations and a set of valid transitions. To manage the downloading and lifecycle of MIDlets, there is software by name Application Management Software. A runtime environment is provided by the AMS. The runtime environment enforces the permissions, security and the execution states and is provided the required scheduling and system classes.


Java Application Descriptor file and Java Archive are the two components that any MIDlet suite is delivered. The JAD file describes the MDIlet suite. The description comprises of the MIDlet suites name, location and size of the JAR file and other configuration and profile requirements.

The MIDlet life-cycle is fundamental to creating any MIDlet.

1.The life-cycle defines the execution states of a MIDlet creation, start, pause, and exit

2.A MIDlet is either in the active state or the paused state.

3.When it is first loaded by the MIDP runtime environment, it will be in the paused state.

4.The runtime will generally call the method startApp() to signal that the MIDlet should now activate itself.

5.Whenever the application is idle, the runtime can put the MIDlet back into the paused state.

6.When it is paused, the application will not receive user interface events.

7.The runtime will call pauseApp() to indicate that it has done this.

8.When the operator is finished with the MIDlet, the runtime will destroy it.

9.Before it does this, it calls the method destroyApp() method.

10.The MIDlet must deallocate resources here as it does when it enters the paused state.

11.In the MIDP documents, `destroyed\' is described as being one of the states that the MIDlet may be in.

What is MIDlet Suite?

A Midlet suite is used to distribute one ore multiple Midlets in a single Java Application Descriptor(JAR) file. All Midlets in a suite are install into device as a single entity and at the runtime all the active Midlets compile and run in the same Java virtual Machine (JVM). The JAR used for holding configurable application properties of a MIDlet suite. 


Explain working MIDlet when application manager started.

MIDlet have very specific lifecycle which is reflect in the methods and behavior of the MIDlet class. The application must extend this class to allow the application management (a piece of device- specific software) to controls the installation, execution, life cycle of  MIDlet and to be able to retrieve properties from the application descriptor and notify and request state changes. The class files will be packaged in a Java Archive (JAR), while an accompanying descriptor file (with a .jad extension) describes the contents of the JAR.

Stages of MIDlet\'s lifecycle

1. When the MIDlet is about to be run, an instance of javax.microedition.midlet.MIDlet class is create. The MIDlet\'s class constructor is run, and the MIDlet is in the Paused state. 

2. Next, MIDlet move into Active state after application manager calling startApp() method which implement with extend MIDlet class. 

3. While the MIDlet is Active state, the application manager can suspend its execution by calling pauseApp() method. This will puts MIDlet back into Paused State. 

4. The MIDlet also place itself into Paused state by calling calling notifyPaused() mehod. 

5. The application manager puts MIDlet form Paused state to Active state by calling startApp() Method. 

6. One addition method resumeRequest() method calling by application manger to put MIDlet into Active state from Paused state. 

7. After application manager execute startApp() method, can terminate the execution by calling destroyApp() method. At that point the MIDlet is destroyed and patiently awaits garbage collection. 

8. A MIDlet can destroy itself by calling notifyDestroyed() method. 

Explain configuration and Profiles.

Configuration is designed for a specific kind of device based on memory constraints and processor power. A Configuration describes a set of APIs, Java Virtual Machine and library, but it does not capable itself  for provide enough detail to developer for building complete applications. It also use subset of Java 2 Platform, Standard Edition(J2SE) APIs that will used on platform, as well as add additional APIs that may be necessary.

Profile is more specific and subsets of configuration, a profile usually include a set of basic APIs for application life cycle, user interface, and persistent storage, to make a complete environment for building complex applications.

What are basics Software\'s for J2ME applications.

A MIDlet is a MID Profile application. A J2ME Midlet\'s main class must extends javax.microedition.midlet.MIDlet. This class define three life-cycle notification methods:

startApp()

pauseApp()

destroyApp().

What is MIDP and cldc.MIDP

Java ME devices implement a Profiles, common of these are the Mobile Information Device Profile (MIDP) which include Mobile devices (such as such as Smartphone, cell phones, and Personal Profile) and Embedded systems (such as Set- top boxes and Personal digital assistant (PDAs)). Profiles are specific and subsets of Configurations, these are of currently two type, Connected Device Configuration (CDC) and the Connected Limited Device Configuration (CLDC).


What is difference between J2SE,J2EE and J2ME?

The Sun Microsystems (now subsidiary of Oracle) devide java into three editions- J2SE, J2EE, J2ME, each having own software development Kit(SDK) .

1. J2SE- Java 2 Standard Edition. This edition consists of application programming interfaces (APIs) needed to build aJava application or applet.

2. J2EE- Java 2 Enterprise Edition. This edition consists of application programming interfaces (APIs) needed to build a application for access server-side systems.

3. J2ME- Java 2 Micro Edition. This edition consists of application programming interfaces (APIs) needed to build a applications for small computing devices, including wireless Java applications.

What is preverifier?

Class File verification is used by Java Virtual Machine (JVM) before full startup of the JVM occurs in running bytecode of an application. This can be done in four Passes- 

Pass-1:- Check byte code attributes, magic number, constant pool must not have any superficial data, and class file must not have extra bytes at end.

Pass-2:- Check every class behaviour and attribute and every class has valid names, classes, descriptor, and packages.

Pass-3:- Check code linking, attribute, and analysis data flow.

Pass-4:- Check where class loading occurs to finalize the class verification process.