Get Latest Job Updates

Get Latest Walkins and Job Updates Directly to your Inbox.
20,000 People Subscribed

Sign Up Now.
Email address
Secure and Spam free...

Java Interview Questions-3

Java Interview Questions-3

Java Interview Questions

 

today and tomorrow walkins jobs in india for freshers and experienced

 

1. What is JAR file?

JAR files is Java Archive fles and it aggregates many files into one. It holds Java classes in a library.JAR files are built on ZIP file format and have .jar file extension.
2. What is a WAR file?

This is Web Archive File and used to store XML, java classes, and JavaServer pages. which is used to distribute a collection of JavaServer Pages, Java Servlets, Java classes, XML files, static Web
pages etc.
3. Give some features of Interface?

It includes −Interface cannot be instantiated
An interface does not contain any constructors.
All of the methods in an interface are abstract.

4.An applet extend which class?

An applet extends java.applet.Applet class.

5.Define JIT compiler?

It improves the runtime performance of computer programs based on bytecode.

6. What is the difference between object oriented programming language and object based programming language?

Object based programming languages follow all the features of OOPs except Inheritance.JavaScript is an example of object based programming languages.

7. What is the purpose of default constructor?

The java compiler creates a default constructor only if there is no constructor in the class.

 

8. Can a constructor be made final?

No, this is not possible.

9. What is static block?

It is used to initialize the static data member, It is excuted before main method at the time of classloading.

10. Define composition?

Holding the reference of the other class within some other class is known as composition.

 

11. What is function overloading?

If a class has multiple functions by same name but different parameters, it is known as Method Overloading.

12. What is function overriding?

If a subclass provides a specific implementation of a method that is already provided by its parent class, it is known as Method Overriding.

13. Difference between Overloading and Overriding?

Method overloading increases the readability of the program. Method overriding provides the specific implementation of the method that is already provided by its super class parameter must be different in case of overloading, parameter must be same in case of overriding.

14. What is final class?

Final classes are created so the methods implemented by that class cannot be overridden. It can’t be inherited.

15. What is NullPointerException?

A NullPointerException is thrown when calling the instance method of a null object, accessing ormodifying the field of a null object etc.

16. What are the ways in which a thread can enter the waiting state?

A thread can enter the waiting state by invoking its sleep method, by blocking on IO, by unsuccessfully attempting to acquire an object’s lock, or by invoking an object’s wait method. It can also enter the waiting state by invoking its deprecated suspend method.

 

17. How does multi-threading take place on a computer with a single CPU?

The operating system’s task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.

18. What invokes a thread’s run method?

After a thread is started, via its start method of the Thread class, the JVM invokes the thread’s run method when the thread is initially executed.
19. Does it matter in what order catch statements for FileNotFoundException and IOException are written?

Yes, it does. The FileNoFoundException is inherited from the IOException. Exception’s subclasses have to be caught first.
20. What is the difference between yielding and sleeping?

When a task invokes its yield method, it returns to the ready state. When a task invokes its sleep method, it returns to the waiting state.
21. Why Vector class is used?
The Vector class provides the capability to implement a growable array of objects. Vector proves to be very useful if you don’t know the size of the array in advance, or you just need one that can change sizes over the lifetime of a program.
22. How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?

Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits,it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns.UTF-16 uses 16-bit and larger bit patterns.

23. What are Wrapper classes?

These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc.

24. What is the difference between a Window and a Frame?

The Frame class extends Window to define a main application window that can have a menu bar.

25. Which package has light weight components?

javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.