There is the list of core java interview questions. If there is any core java interview question that has been asked to you, kindly post it in the ask question. Interview Questions for beginners and professionals with a list of top frequently asked interview questions and answers on job, hr, competency, java, database. 3/30/ Core Java Interview Questions | OOPs interview questions javatpoint 1/ Core Java.

Javatpoint Java Interview Questions Pdf

Language:English, Japanese, Arabic
Country:South Africa
Published (Last):08.10.2015
ePub File Size:26.40 MB
PDF File Size:14.54 MB
Distribution:Free* [*Sign up for free]
Uploaded by: SAMATHA

Download as PDF, TXT or read online from Scribd. Flag for Core Java Interview Questions | OOPs interview questions ‐ javatpoint. Content Menu. Core Java Interview Questions _ OOPs Interview Questions - Javatpoint - Download as PDF File .pdf), Text File .txt) or read online. IQ. Core Java Interview Questions | OOPs interview questions - javatpoint Java . Java 10 Free Java Programing Books for beginners - download, pdf and.

No, you can only extend a single class but you can implement multiple interfaces. Why is this no longer true? There should be no clashes between the implementation in the parent class an interface because the parent class takes precedence. However, if two interfaces implement the same default method, there will be a compile time error.

The exact questions I ask to get all of those details can vary and I would expect most senior developers to give me most of if not all of that information with one or two questions. However, I am still surprised that, 3 years after release, many Java developers are still not familiar with basic Java 8 changes such as default methods.

He holds a computer science degree from the University of Wisconsin. The simplicity of the question and their innate familiarity with the problem space gives me a really good glimpse into their level of experience and understanding. The best way to prepare for such a question would be to break out the source for HashMap!

Matt Ferguson has over 23 years of progressive experience in the architecture, development, and management of software products and services. Ferguson has led engineering and product management teams individually and combined to bring quality and effective customer-driven solutions to market. Prior to joining Zeeto, he was Sr. Director at Sensus.

I really want to see that the candidate can communicate deep understanding, communicate it in a story and engage me in problem solving session.

Hence instead of the rote language specific question about variables, arrays, interfaces, packages, serialization etc. I prefer to see the developer use the language in a series of simple exercise that should last no more that 2 to 5 minutes each. Now add a method reversing the words only. Such simple interactive practical questions lets you inspect technical knowledge while insuring the communication skills are there to discuss interpretation of requirements.

It is pretty straight forward to create simple exercises like this around a languages common nuances to insure technical competency. It is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compliation. Which are the two subclasses under Exception class?

When throws keyword is used? If a method does not handle a checked exception, the method must declare it using the throwskeyword. The throws keyword appears at the end of a method's signature. When throw keyword is used? An exception can be thrown, either a newly instantiated one or an exception that you just caught, by using throw keyword.

How finally used under Exception Handling? The finally keyword is used to create a block of code that follows a try block. A finally block of code always executes, whether or not an exception has occurred.

What things should be kept in mind while creating your own exceptions in Java? If you want to write a checked exception that is automatically enforced by the Handle or Declare Rule, you need to extend the Exception class. You want to write a runtime exception, you need to extend the RuntimeException class.

Define Inheritance? It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order. When super keyword is used? If the method overrides one of its superclass's methods, overridden method can be invoked through the use of the keyword super.

It can be also used to refer to a hidden field. What is Polymorphism? Polymorphism is the ability of an object to take on many forms. The most common use of polymorphism in OOP occurs when a parent class reference is used to refer to a child class object. What is Abstraction? It refers to the ability to make a class abstract in OOP.

It helps to reduce the complexity and also improves the maintainability of the system. What is Abstract class? These classes cannot be instantiated and are either partially implemented or not at all implemented. This class contains one or more abstract methods which are simply method declarations without a body.

When Abstract methods are used? If you want a class to contain a particular method but you want the actual implementation of that method to be determined by child classes, you can declare the method in the parent class as abstract. What is Encapsulation? It is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. Therefore encapsulation is also referred to as data hiding.

What is the primary benefit of Encapsulation? The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code.

With this Encapsulation gives maintainability, flexibility and extensibility to our code. What is an Interface? An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface. Give some features of Interface?

Core Java Interview Questions and Answers

All of the methods in an interface are abstract. Define Packages in Java? A Package can be defined as a grouping of related types classes, interfaces, enumerations and annotations providing access protection and name space management. Why Packages are used?

What do you mean by Multithreaded program? A multithreaded program contains two or more parts that can run concurrently.

Each part of such a program is called a thread, and each thread defines a separate path of execution. What are the two ways in which Thread can be created? Thread can be created by: implementing Runnable interface, extending the Thread class. What is an applet?

An applet is a Java program that runs in a Web browser. An applet can be a fully functional Java application because it has the entire Java API at its disposal.

An applet extend which class? An applet extends java. Applet class. Explain garbage collection in Java? It uses garbage collection to free the memory. By cleaning those objects that is no longer reference by any of the program. Define immutable object? Explain the usage of this with constructors? It is used with variables or methods and used to call constructer of same class.

Explain Set Interface? It is a collection of element which cannot contain duplicate elements. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.

Explain TreeSet? It is a Set implemented when we want elements in a sorted order. What is Comparable Interface?

It is used to sort collections and arrays of objects using the collections.

The objects of the class implementing the Comparable interface can be ordered. Difference between throw and throws? It includes: Throw is used to trigger an exception where as throws is used in declaration of exception. Without throws, Checked exception cannot be handled where as checked exception can be propagated with throws. Java Runtime Environment? JAR files is Java Archive fles and it aggregates many files into one. It holds Java classes in a library.

What is a WAR file? Define JIT compiler? It improves the runtime performance of computer programs based on bytecode. 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. What is the purpose of default constructor? The java compiler creates a default constructor only if there is no constructor in the class.

Can a constructor be made final? No, this is not possible.

What is static block? It is used to initialize the static data member, It is excuted before main method at the time of classloading. Define composition? Holding the reference of the other class within some other class is known as composition.

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

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. 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.

What is final class? Final classes are created so the methods implemented by that class cannot be overridden. What is NullPointerException? A NullPointerException is thrown when calling the instance method of a null object, accessing or modifying the field of a null object etc.

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. 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. 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.

Yes, it does. Exception's subclasses have to be caught first. 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. 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.

UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF uses bit and larger bit patterns. What are Wrapper classes?

Core Java Interview Questions

These are classes that allow primitive types to be accessed as objects. Example: Integer, Character, Double, Boolean etc. 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. Which package has light weight components? Swing package. What is the difference between the paint and repaint methods?

The paint method supports painting via a Graphics object. The repaint method is used to cause paint to be invoked by the AWT painting thread. What is the purpose of File class? It is used to create objects that provide access to the files and directories of a local file system.

Which class should you use to obtain design information about an object? The Class class is used to obtain information about an object's design and java. Class class instance represent classes, interfaces in a running Java application. What is the difference between static and non-static variables?

A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.

What is Serialization and deserialization? Serialization is the process of writing the state of an object to a byte stream. Deserialization is the process of restoring these objects. What are use cases? It is part of the analysis of a program and describes a situation that a program might encounter and what behavior the program should exhibit in that circumstance. Explain the use of sublass in a Java program? Sub class inherits all the public and protected methods and the implementation.

It also inherits all the default modifier methods and their implementation. How to add menushortcut to menu item? If there is a button instance called b1, you may add menu short cut by calling b1. Can you write a Java class that could be used both as an applet as well as an application? Yes, just add a main method to the applet.

What is the difference between Swing and AWT components? AWT components are heavy-weight, whereas Swing components are lightweight.

Heavy weight components depend on the local windowing toolkit. For example, java. Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button. What's the difference between constructors and other methods?

Constructors must have the same name as the class and can not return a value. They are only called once while regular methods could be called many times. Is there any limitation of using Inheritance?

Yes, since inheritance inherits everything from the super class and interface, it may make the subclass too clustering and sometimes error-prone when dynamic overriding or dynamic overloading in some situation.

When is the ArrayStoreException thrown?

1500+ Java Interview Questions and Answers

When copying elements between different arrays, if the source or destination arguments are not arrays or their types are not compatible, an ArrayStoreException will be thrown. Can you call one constructor from another if a class has multiple constructors? Yes, use this syntax. What's the difference between the methods sleep and wait? The code sleep ; puts thread aside for exactly two seconds. The code wait , causes a wait of up to two second. A thread could stop waiting earlier if it receives the notify or notifyAll call.

The method wait is defined in the class Object and the method sleep is defined in the class Thread. When ArithmeticException is thrown? The ArithmeticException is thrown when integer is divided by zero or taking the remainder of a number by zero.An exception is a problem that arises during the execution of a program. We can also specify annotation availability to either compile time only or till runtime also.

An Object is first declared, then instantiated and then it is initialized. What is Dynamic Binding late binding? A class consist of Local variable, instance variables and class variables.

Object based programming languages follow all the features of OOPs except Inheritance. I truly appreciate your efforts in writing the answers.

MAISIE from Vancouver
Look through my other articles. I'm keen on contract bridge. I enjoy solidly.