Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1. Does garbage collection guarantee that a program will not run out of memory?
Ans:
Garbage collection does not guarantee that a program will not run out of memory. It
is possible for programs to use up memory resources faster than they are garbage
collected. It is also possible for programs to create objects that are not subject to
garbage collection.
2. What is JVM?
Ans:
JVM is Java Virtual Machine which is a run time environment for the compiled
java class file.
Ans:
JVM's are not platform independent. JVM's are platform specific run time
implementation provided by the vendor.
Ans:
JDK is Java Development Kit which is for development purpose and it includes
execution environment also. But JVM is purely a run time environment and hence
you will not be able to compile your source files using a JVM.
Ans:
It is an implementation of the Java Virtual Machine* which actually executes Java
programs. It is a bundle of software that you can use to develop Java based
applications. Java Runtime Environment is a plug-in needed for running java
programs.
Ans:
The Java Class loader is a part of the Java Runtime Environment that dynamically
loads Java classes into the Java Virtual Machine. Usually classes are only loaded on
demand. The Java run time system does not need to know about files and file
systems because of class loaders.
Ans:
Using the java just in time compiler (really a second compiler) at the particular
system platform complies the byte code into particular system code, once the code
has been re-compiled by the JIT complier, it will usually run more quickly in the
computer.
Ans:
No Java doesn‟t supports any default arguments from command line arguments.
Ans:
Java is not purely object-oriented.
Ans:
CLASSPATH and PATH are the two variables.
Ans:
Import keyword is used to import a package in java.
Ans:
The Enumeration interface defines the methods by which you can enumerate (obtain
one at a time) the elements in a collection of objects.
13. Which object oriented Concept is achieved by using overloading and overriding?
Ans:
Polymorphism is an OOPs concept which supports overloading & overriding.
Ans:
The evolution of Java was the time when the Unicode standards had been defined for
very smaller character set. Java was designed for using Unicode Transformed Format
(UTF)-16, when the UTF-16 was designed. The „char‟ data type in Java originally
used for representing 16-bit Unicode. Hence Java uses Unicode standard.
15. Where did the Java name come from? What does it stand for?
Ans:
"Java" is supposed to have got its name from one of the
members of the original developer team Kim Polese. But it is
widely believed that Java (originally called "Oak") was
conceived by the original creators at a local coffee bar.
16. What if I write static public void main instead of public static void main?
Ans:
Yes possible, there is no difference between public static void main and static public
void main.
Ans:
Yes it is possible. While starting the application we mention the class name to be
run. The JVM will look for the Main method only in the class whose name you have
mentioned. Hence there is not conflict amongst the multiple classes having main ()
method.
Ans:
Static variables and methods are instantiated only once per class. In other words
they are class variables, not instance variables. If you change the value of a static
variable in a particular object, the value of that variable changes for all instances of
that class. Static methods can be referenced with the name of the class rather than
the name of a particular object of the class (though that works too). That's how
library methods like System.out.println() work. out is a static field in the
java.lang.System class.
Ans:
Pointers are the notorious source of bugs, it makes the program less secured. So,
java doesn't support pointers directly.
Ans:
No not required. main() method should be defined only if the source class is a java
application.
Ans:
Main () method doesn't return anything hence declared void.
23. I want to print "Hello" even before main () is executed. How will you achieve that?
Ans:
Print the statement inside a static block of code. Static blocks get executed when the
class gets loaded into the memory and even before the creation of an object. Hence
it will be executed before the main () method. And it will be executed only once.
Ans:
OOPS is nothing but collection of concepts, if a language supports that concepts then
that language known as Object Oriented Language.
Ans:
Classpath is a parameter set either on the command-line, or through an
environment variable that tells the Java Virtual Machine or the Java compiler where
to look for user-defined classes and packages.
Ans:
The PATH is the system variable that your operating system uses to locate needed
executables from the command line or Terminal window. The PATH system variable
can be set using System Utility in control panel on Windows, or in your shell's startup
file on Linux and Solaris.
Ans:
Java Language Security and Byte code Verification. The Java language is designed to
be type-safe and easy to use. It provides automatic memory management, garbage
collection, and range-checking on arrays.
Ans:
According to Java Soft, "A Java Bean is a reusable software component that can be
manipulated visually in a builder tool."
Ans:
A volatile program is one whose result always store in main memory of the computer
i.e. RAM.
30. What is nonvolatile and persistent program?
Ans:
A non-volatile program is one whose result is stored in secondary storage devices
i.e. hard disk, magnetic tapes etc.
Ans:
As main () called by JVM which in-built to operating System, If a method called from
outside the package, it should be declared as public in java. So main () method
public in java.
Ans:
The javap command disassembles one or more class files. Its output depends on the
options used. If no options are used, javap prints out the package, protected, and
public fields and methods of the classes passed to it. javap prints its output to
stdout.
Ans:
Java Virtual Machine (JVM).
Ans:
J2SE (Java 2 Standard Edition)
Ans:
WORA (Write Once Runs Anywhere)
Ans:
Multithreading responsible for creating distributed application?