Beruflich Dokumente
Kultur Dokumente
SEMESTER - IV
BK ID - B2119
Assignment Set -1
Q.1. List any ten Java command tools with a short description of each. 1*10
Answer:-
Answer:-
(i) Arithmetic Operators: - Addition, Subtraction, Multiplication, Division and Modulus are the
various arithmetic operations that can be performed in Java. Table a. lists different Arithmetic
Operators.
Table a: List of Arithmetic Operators
In Java, to compare the values of two or more operators, comparison operators are used. Table b.
lists various Comparison Operators in Java.
Logical Operators:-
In Java, to perform Boolean operation on operands we use Logical operators. Table c. lists various
Logical Operators in Java.
Answer:-
Packages:-
To create a package is quite easy: simply include a package command as the first statement in a Java
source file. Any classes declared within that file will belong to the specified package. The package
statement defines a name space in which classes are stored. If you omit the package statement, the
class names are put into the default package, which has no name. (This is why you haven't had to
worry about packages before now.) While the default package is fine for short, sample programs, it
is inadequate for real applications. Most of the time, you will define a package for your code. This is
the general form of the package statement: package pkg;
Here, pkg is the name of the package. For example, the following statement creates a package called
MyPackage.
Package My Package;
Java uses file system directories to store packages. For example, the .class files for any classes you
declare to be part of MyPackage must be stored in a directory called MyPackage. Remember that
case is significant, and the directory name must match the package name exactly.
Interface:-
An interface is defined much like a class. This is the general form of an interface: access interface
name {return-type method-name1 (parameter-list); return-type method-name2 (parameter-list);
type final-varname1 = value; type final-varname2 = value; // ... return-type method-nameN
(parameter-list); type final-varnameN = value;}
Here, access is either public or not used. When no access specifier is included, then default access
results, and the interface is only available to other members of the package in which it is declared.
When it is declared as public, the interface can be used by any other code. name is the name of the
interface, and can be any valid identifier. Notice that the methods which are declared have no
bodies. They end with a semicolon after the parameter list. They are, essentially, abstract methods;
there can be no default implementation of any method specified within an interface. Each class that
includes an interface must implement all of the methods.
Here is an example of an interface definition. It declares a simple interface which contains one
method called callback ( ) that takes a single integer parameter.
interface Callback {
}
Assignment Set -2
Answer:-
Components of an event:-
i. Event Object – When the user interacts with the application by pressing a key or clicking a mouse
button, an event is generated. The operating system traps this event and the data associated with
it, for example, the time at which the event occurred, the event type (like a keypress or a mouse
click). This data is then passed on to the application to which the event belongs. In Java, events are
represented by objects that describe the events themselves. Java has a number of classes that
describe and handle different categories of event.
ii. Event Source – An event source is an object that generates an event. For example, if you click on a
button, an ActionEvent object is generated. The object of the ActionEvent class contains
information about the event.
iii. Event-handler – An event-handler is a method that understands the event and processes it. The
event-handler method takes an event object as a parameter.
Q.2. What is JDBC? List down the steps to load ODBC driver? 10
Answer: - ODBC is the abbreviation for Open Database Connectivity, a standard database access
method developed by Microsoft Corporation. The goal of ODBC is to make it possible to access any
data from any application, regardless of which database management system (DBMS) is handling the
data. ODBC manages this by inserting a middle layer, called a driver, between an application and the
DBMS. The purpose of this layer is to translate the queries of the application into commands that
the DBMS understands. For this to work, both the application and the DBMS must be ODBC-
compliant i.e. the application must be capable of issuing ODBC commands and the DBMS must be
capable of responding to them.
Answer:-
a) CORBA: - CORBA stands for Common Object Request Broker Architecture. RMI needs the 2
objects participating in communication be written in Java. CORBA is a distributed computing
technology where the participating objects need not only be written in Java.
i. Java IDL is a technology for distributed objects-that is, objects interacting on different platforms
across a network.
ii. Java IDL is similar to RMI (Remote Method Invocation), which supports distributed objects written
entirely in the Java programming language. However, Java IDL enables objects to interact
regardless of whether they’re written in the Java programming language or another language such
as C, C++, COBOL, or others.
iii. Java IDL is based on the Common Object Request Brokerage Architecture (CORBA), an industry-
standard distributed object model.
iv. A key feature of CORBA is IDL, a language-neutral Interface Definition Language. Each language
that supports CORBA has its own IDL mapping and as its name implies, Java IDL supports the
mapping for Java. CORBA and the IDL mappings are the work of an industry consortium known as
the OMG, or Object Management Group.
v. To support interaction between objects in separate programs, Java IDL provides an Object Request
Broker, or ORB. The ORB is a class library that enables low-level communication between Java IDL
applications and other CORBA-compliant applications.
Example: The Hello Client-Server: - This tutorial teaches the basic tasks in building a CORBA
distributed application using Java IDL. You will build the classic Hello World program as a distributed
application. The Hello World program has a single operation that returns a string to be printed.
i. The client (applet or application) invokes the sayHello operation of the HelloServer.
ii. The ORB transfers that invocation to the server object registered for IDL interface.
iii. The server’s sayHello method runs, returning a Java String.
iv. The ORB transfers that String back to the client.
v. The client prints the value of the String.
b) BeanBox: - The BeanBox is a very simple test container. It allows you to try out both the BDK
example beans and your own newly created beans.
Note that the BeanBox is intended as a test container and as a reference base, but it is not intended
as a serious application development tool.