Search your topic in Java2share
Home > FAQs
eXTReMe Tracker

CoreJava FAQs

Untitled Document

Q5.What are statements in JAVA ?
Statements are equivalent to sentences in natural languages. A statement forms a complete
unit of execution. The following types of expressions can be made into a statement by
terminating the expression with a semicolon
• Assignment expressions
• Any use of ++ or --
• Method calls
• Object creation expressions
These kinds of statements are called expression statements. In addition to these kinds of
expression statements, there are two other kinds of statements. A declaration statement
declares a variable. A control flow statement regulates the order in which statements get
executed. The for loop and the if statement are both examples of control flow statements.

Q6.What is JAR file?
JavaARchive files are a big glob of Java classes, images, audio, etc., compressed to make
one simple, smaller file to ease Applet downloading. Normally when a browser encounters
an applet, it goes and downloads all the files, images, audio, used by the Applet separately.
This can lead to slower downloads.

Q7.What is JNI?
JNI is an acronym of Java Native Interface. Using JNI we can call functions which are written in other languages from Java. Following are its advantages and disadvantages.
• You want to use your existing library which was previously written in other
• You want to call Windows API function.
• For the sake of execution speed.
• You want to call API function of some server product which is in c or c++ from java
• You can’t say write once run anywhere.
• Difficult to debug runtime error in native code.
• Potential security risk.
• You can’t call it from Applet.

Q8.What is serialization?
Quite simply, object serialization provides a program the ability to read or write a whole object to and from a raw byte stream. It allows Java objects and primitives to be encoded into a byte stream suitable for streaming to some type of network or to a file-system, or more generally, to a transmission medium or storage facility. A seralizable object must implement the Serilizable interface. We use ObjectOutputStream to write this object to a stream and ObjectInputStream to read it from the stream.