Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
Look up keyword
Like this
0 of .
Results for:
No results containing your search query
P. 1
java ans

java ans

Ratings: (0)|Views: 10|Likes:
Published by gurugabru

More info:

Published by: gurugabru on Dec 19, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Ques 1. What are the uses of random access file over sequential accessfile?Ans: 1
Random Access FilesThe term random access means that data can be read from or written to random locationswithin a file.In all the above mentioned streams, data is read and written as a continuousstream of information.Java provides the RandomAccessFile class to perform I/Ooperations a t specified locations within a file.The RandomAccessFile class implementsthe DataInput and DataOutput interfaces for performing I/O using the primitive datatypes. The RandomAccessFile class also supports permissions like read and write, andallows files to be accessed in read-only and read-writeCreating a Random Access FileThere are two ways to create a random access file- using the pathname as a string or using an object of the File class.RandomAccessFile (String pathname, String mode);RandomAccessFile (File name, String mode);ExamplerandomFile = new RandomAccessFile (“iotets.txt”,”rw”);or File file1 = new File (“iotest.txt”);RandomAccessFile randomFile = new RandomAccessFile(file1, “rw”);The second argument is the mode argument that determines whether you have read-onlyor read/write (rw) access to the file.The RandomAccessFile class has several methodsthat allow random access to the content within the file.Creating a Random Access FileThe second argument is the mode argument that determines whether you have read-onlyor read/write (rw) access to the file. The RandomAccessFile class has several methodsthat allow random access to the content within the fileMethod Explanationvoid seek (long pos )Sets the file pointer to a particular location insidethe file.longgetFilePointer ()Return the current location of the file pointer.long length ()Returns the length of the file, in bytes.
Ques2 What do you mean by the term CORBA?Ans
 CORBA stands for Common Object Request Broker Architecture. CORBA is adistributed computing technology where the participating objects need not only bewritten in Java.What is Java IDL?Java IDL is a technology for distributed objects-that is, objects interacting on different platforms across a network.
Java IDL is similar to RMI (Remote Method Invocation), which supports distributedobjects written entirely in the Java programming language. However. Java IDL enablesobjects to interact regardless of whether they’re written in the Java programminglanguage or another language such as C, C++, COBOL, or others.Java IDL is based on the Common Object Request Brokerage Architecture (CORBA), anindustry-standard distributed object model.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.To support interaction between objects in separate programs, Java IDL provides anObject Request Broker, or ORB. The ORB is a class library that enables low-levelcommunication between Java IDL applications and other CORBA-compliantapplications
Ques3 Explain the different methods used in Input Stream class andOutput Stream class?Ans3
ClassesThe FileInputStream and FileOutputStream ClassesThese streams are classified as mode streams as they read and write data from disk files.The classes associated with these streams have constructors that allows you to specifythe path of the file to which they are connected.The FileInputStream class allows you toread input from a file in the form of a stream.The FileOutputStream class allows you towrite output to a file stream.ExampleFileInputStream inputfile = new FileInputStream (“Employee.dat”);FileOutputStream outputfile = new FileOutputStream (“binus.dat”);The BufferedInputStream and BufferedOutputStream ClassesThe BufferedInputStream class creates and maintains a buffer for an input stream. Thisclass is used to increase the efficiency of input operations. This is done by reading datafrom the stream one byte at a time. The BufferedOutputStream class creates andmaintains a buffer for the output stream. Both the classes represents filter streams.The DataInputStream and DataOutputStream ClassesThe DataInputStream and DataOutputStream classes are filter streams that allow thereading and writing of Java primitive data types. The DataInputStream class provides thecapability to read primitive data types from an input stream. It implements the methods presents in the Data Input interface.Methods of the DataInputStream class
Method Explanation boolean readBoolean()Reads one byte and returns true if that byte is nonzero, false if it iszero. byte readByte ()Reads a byte as an 8-bit signed value.char readChar ()Reads a Unicode character.int readInt ()Reads an integer value.
The DataInputStream class provides methods that are complementary to the methods of DataInputStream classes. It keeps track of the number of bytes written to the outputstream.Methods of the DataOutputStream Class
Method Explanationvoid writeChar (int v )Writes a character to the output stream.void writeLong (long v)Writes a long integer to the output stream.void writeInt (int v )Writes an integer to the output stream.
The ByteArrayInputStream and ByteArrayOutputStream ClassesThese classes allow you to read and write to an array of bytes.
MethodExplanationByteArrayInputStream (byte [] b)Creates an input stream of the array of byesint size ()Returns the total number of bytes written to the stream.
Ques4 Explain the procedure for connecting to the database?Ans
ODBC is an abbreviation of Open Database Connectivity, a standard databaseaccess method developed by Microsoft Corporation.The goal of ODBC is to make it possible to access any data from any application, regardless of which databasemanagement system (DBMS) is handling the data.ODBC manages this by inserting amiddle layer, called a driver, between an application and the DBMS. The purpose of thislayer is to translate the queries of the application into commands that the DBMSunderstandsJDBCJDBC provides a database-programming interface for Java programs. Since the ODBC iswritten in ‘C’ language, a Java program cannot directly communicate with an ODBCdriver.JavaSoft created the JDBC-ODBC Bridge driver that translates the JDBC API tothe ODBC API. It is used with ODBC drivers.JDBC Driver Manager The JDBC driver manager is the backbone of the JDBC architecture.The function of theJDBC driver manager is to connect a Java application to the appropriate driver.JDBC-ODBC BridgeThe JDBC-ODBC Bridge allows you to use the ODBC driver as JDBC driversJDBC Application Architecture

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->