Académique Documents
Professionnel Documents
Culture Documents
Ans.
Java is known as platform-neutral language because Java's bytecodes are
designed to be read, interpreted, and executed in exactly the same manner
on any computer hardware or operating system that supports a Java run-
time.
2. How is Java more secure than other languages?
Ans.
One of the potential terrors of the Internet is the possibility of security
breaches- viruses that infect your computer, or hackers who take advantage
of a software glitch to invade your personal cyberspace and make off with
confidential information.
Applets, which are Java programs, are automatically downloaded when a
Web page is displayed. Java applets, by default, execute within the Java
executing environment and are limited to the environment. This means, an
applet cannot access the local file system or other programs of the system
where it executes. This reduces the chance that simply viewing someone's
page might harm your system or data. No system is absolutely reliable and
none will ever be; but Java represents the state-of-the-art in reducing the
chances of a disaster. 3. What is multithreading? How does it improve the
performance of Java?
Ans.
In a multithreading environment, a thread is the smallest unit of
dispatchable code. This means that a single program can perform two or
more tasks simultaneously. For instance a text editor can format text at the
same time that it is printing.
The benefit of Java's multithreading is that the main loop/polling
mechanism is eliminated. One thread can pause without stopping other
parts of the program. For example, the idle time created when a thread
reads data from a network or waits for user input can be utilized elsewhere.
When a thread blocks in a Java program, only the single thread that is
blocked pauses. All other threads continue to run.
2. What is a bytecode ?
Ans:
Bytecode is a compiled format of a Java program. Once a Java program is
converted into bytecode it can be transferred across the network and
executed by a Java Virtual Machine (JVM).
3. What is an appletviewer?
Ans:
An appletviewer allows you to run an applet without the overhead of
running a Web browser.
Ans.
While Do-While
1. The loop body is executed only 1.The loop body is executed at least
when the condition stated in the once, regardless of the condition
statement is true. evaluating to true & false.
2. It is also called top tested loop. 2. It is also called bottom tested loop.
3. Before the loop body executed, the 3. After the loop body is executed once, the
condition of the while statement condition in the do-while statement
evaluated. checked.
While For
i) In this you can’t Initialized more than one variable
i) You can
at Initialized more than one
a time. variable at a time.
ii) Like initialization section the increment section
ii) increment
also section also not have more
not have more than two parts. than two parts.
iii) It is not permissible to use expression iii) It is permissible to use expression in the
in the initialization and the Increment initialization and the Increment parts.
parts.
Continue Break
a) The continue statement stops the current a) We can force immediate termination of
iteration of a loop and immediately starts the loop, by passing any remaining code in the
next iteration of the same loop. body of the loop.
b) When the current iteration of a loop stops the b) Break statement is encountered inside the
statement after the continue statement in the loop, the loop is terminated and program
loop are not executed. control resumes the next statement.
c) You can use the continue statement in the
c) You can use the continue statement in the while, do-while and for statements and also
while, do-while and for statements but not in the use in the switch statement.
switch statement.