CH - 3 Getting Started With Programming Using IDE
CH - 3 Getting Started With Programming Using IDE
CH - 3 Getting Started With Programming Using IDE
Assignments Type A: Very Short / Short Answer Questions 1. Why is Java often termed as platform? Ans: The word platform generally is used to refer to some combination of hardware and software. The Java platform is a new software designed to deliver and run highly interactive, dynamic and secure applications on networked computer systems.
2.
What is bytecode? Ans: Contrary to ordinary compilers, the Java compiler does not produce native executable code for a particular machine. Instead it produces a special format called bytecode. The Java byte code looks a lot like machine language, but unlike machine language Java Byte code is exactly the same on every platform.
3.
How is Java platform independent? Ans: The Java programs need to be written just once, which can be run on different platforms without making changes in the Java program. Only the Java interpreter (JVM) is changed depending upon the platform. This characteristics make it platform independent.
Page | 1
4.
What is JVM? Ans: The Java Virtual Machine is an abstract machine designed to be implemented on the top of existing processor. It hides the underlying operating system from Java applications.
5.
Describe ordinary compilation process? Ans: In ordinary compilation, the source code is converted to a machine language, which is dependent upon the machine or the platform. This resultant machine code is called native executable code.
6.
Describe Java compilation. Ans: The Java compiler does not produce native executable code for a particular machine. Instead it produces a special format called bytecode. The Java byte code looks a lot like machine language, but unlike machine language Java Byte code is exactly the same on every platform.
7.
How is Java bytecode executed? Ans: The interpreter (JVM) reads the bytecode and translates it into the native language of the host machine on the fly.
8.
Ans: The Java API (Application Programming Interface) are libraries of compiled code that can be used in your programs.
9.
What are RAD tools? Ans: The RAD tools are the tools that enable one to create applications in shorter time as compared to conventional language. Through RAD tools, you can not only develop a small utility programs, but also a large enterprise system or large distribution applications.
10. What is event? What is message? How is it related to an event? Ans: An Event refers to the occurrence of an activity. An event is an object that gets generated when user does something such as mouse click, dragging, pressing a key on the keyboard, etc. A Message is the information / request sent to the application. Each time an event occurs, it causes a message to be sent to the operating system.
11. What are properties? What is property window? Ans: The controls/objects that you draw on your frame/window have some properties associated with them. Different controls have different properties associated with them. The properties window provides an easy way to set properties for all objects on a frame/ window. This window
Page | 3
settings
for
the
currently
selected
12. What is code editor? Ans: The Code Editor window is where you write Java code for your application. By code we mean language statements, constants and declarations. The code editor window serves as an editor for entering application code.
13. What are containers? Give examples. Ans: A container is a control that can hold other controls within it e.g. Panel.
14. What are child controls? Ans: Controls inside a container are known as child controls. The child controls can exist completely inside their containers.
15. What happens to container control and its child controls if you delete a. The container control, Ans: If we delete a container control, all its child controls automatically get deleted. b. A child control, Ans: If we delete a child control, all other child controls and container controls are not deleted.
Page | 4
c. All child controls. Ans: If we delete all child controls, all its child controls automatically get deleted and container control would not be deleted.
Type B: Short / Long Answer Questions 1. Java is both a programming language and a platform. Comment. Ans: Like any other programming language, we can use Java to write or create various types of computer applications. The word platform generally is used to refer to some combination of hardware and software. The Java platform is a new software platform designed to deliver and run highly interactive, dynamic and secure applications on networked computer systems.
2.
Briefly write the history of Java. Ans: Originally, Java started as an elite project (code named Green) to find a way of allowing different electronic devices such as TV-top boxes and controllers to use a common language. This language for electronic devices was originally named Oak (later renamed Java) but failed to find a niche despite its potential.
3.
How are bytecode and platform independence interrelated? Ans: The Java compiler does not produce native executable code for a particular machine. Instead it produces a special format called bytecode. Java is essentially platform
Page | 5
independent. Change of platform does not affect the original Java program/application.
4.
What is the role of JVM in platform independence? Ans: The Java Virtual Machine is an abstract machine designed to be implemented on the top of existing processor. It hides the underlying operating system from Java applications. Program written in Java are compiled into Java Byte Code, which is then interpreted by a special Java interpreter for specific platform. Actually this Java interpreter is known as Java Virtual Machine (JVM). The Java programs need to be written just once, which can be run on different platforms without making changes in the Java program. Only the Java interpreter (JVM) is changed depending upon the platform. This characteristic make it platform independent.
5.
What are different characteristics of Java? Ans: Although Java has many and many characteristics that make it eligible for a powerful and popular language. Write Once Run Anywhere (WORA): The Java programs need to be written just once, which can be run on different platforms without making changes in the Java program. Only the Java interpreter is changed depending upon the platform.
a.
Page | 6
Light Weight Code: With Java, big and useful applications can be created with very light code. No huge coding is required.
b.
Security: Java offers many security features to make its programs safe and secure.
c.
Built-in Graphics: Java offers many built-in graphics features and routines which can be used to make Java application more visual.
d.
Supports Multimedia: Java is ideally suited for integration of video, audio, animation and graphics in Internet Environment.
e.
Platform independent: Java is essentially platform independent. Change of platform does not affect the original Java program/application.
f.
Open Product: Java is an open product, freely available to all. However, there exist some special time-saving Java Development Kits, which can be availed by paying small amounts.
g.
6.
How are events, messages, methods and properties interrelated? Ans: Properties can be thought of as an objects attributes, methods as its actions, and events as its responses. A message as the information / request sent to the application.
7.
Page | 7
Ans: Controls are component objects such as text fields, labels, list boxes etc., that are drawn on frame to get data input or to display output. jTextField allows editing/displaying of a single line of text. jTextField is an input area where the user can type in characters. The various methods and properties associated with the jTextField is given
a.
jLabel provides text instructions or information. It displays a single line of read-only text, an image or both text and image. The various methods and properties associated with the jLabel is given
b.
Page | 8
c. We have used radio buttons when we wanted to provide the user several choices and allowed him to select one of the choices (the radio buttons belong to a group allowing the user to select single option). But radio buttons occupy a lot of space. Thus, in case of too many options we used Combo boxes as they help save space and are less cumbersome to design as compared to radio button.
Page | 9
d. We used check box and list when we wanted to display multiple options like selecting favourite sports or ordering multiple food items in a restaurant. The list is a preferred option over check box in situations wherever multiple options are required to be selected from a large number of known set of options as they help save space and are less cumbersome to design as compared to check boxes.
Page | 10