Friday, April 4, 2014

couch mode print story

Java Programming Interview Questions and Answers

Java Programming Interview Questions

1. What is JVM?

JVM is Java Virtual Machine which is a run time environment for the compiled java class files.
OR
The Java interpreter along with the runtime environment required to run the Java application in called as Java virtual machine(JVM)


2. What is the most important feature of Java?

Java is a platform independent language.


3. What do you mean by platform independence?

Platform independence means that we can write and compile the java code in one platform (eg Windows) and can execute the class in any other supported platform eg (Linux,Solaris,etc).


4. What is the difference between a JDK and a JVM?

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.


5. What is a pointer and does Java support pointers?

Pointer is a reference handle to a memory location. Improper handling of pointers leads to memory leaks and
reliability issues hence Java doesn't support the usage of pointers.


6. What is the base class of all classes?

java.lang.Object


7. What are the access modifiers in Java?

here are 3 access modifiers.
Public,
protected and
private,
and the default one if no identifier is specified is called friendly, but programmer cannot specify the friendly identifier explicitly.


8. Does Java support multiple inheritance?

Java doesn't support multiple inheritance.


9. Is Java a pure object oriented language?

Java uses primitive data types and hence is not a pure object oriented language.


10. What is are packages?

A package is a collection of related classes and interfaces providing access protection and namespace management.


11. What is meant by Inheritance and what are its advantages?

Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses.


12. Are arrays primitive data types?

In Java, Arrays are objects.


13. What is difference between Path and Classpath?

Path and Classpath are operating system level environment variales. Path is used define where the system can find the executables(.exe) files and classpath is used to specify the location .class files.


14. What is the difference between superclass and subclass?

A super class is a class that is inherited whereas sub class is a class that does the inheriting.


15. What are local variables?

Local varaiables are those which are declared within a block of code like methods. Local variables should be initialised before accessing them.


16. What is an abstract class?

An abstract class is a class designed with implementation gaps for subclasses to fill in and is deliberately incomplete.


17. What are instance variables?

Instance variables are those which are defined at the class level. Instance variables need not be initialized
before using them as they are automatically initialized to their default values.


18. What is synchronization?

Synchronization is the mechanism that ensures that only one thread is accessed the resources at a time.


19. What is an applet?

Applet is a dynamic and interactive program that runs inside a web page displayed by a java capable browser


20. What is the lifecycle of an applet?

init() method - Can be called when an applet is first loaded
start() method - Can be called each time an applet is started.
paint() method - Can be called when the applet is minimized or maximized.
stop() method - Can be used when the browser moves off the applet’s page.
destroy() method - Can be called when the browser is finished with the applet.

Written




0 comments:

Post a Comment