3/30/ Core Java Interview Questions | OOPs interview questions javatpoint scretch.info 1/ Core Java. Dear readers, these Java Interview Questions have been designed especially to get you acquainted with the nature of questions you may encounter during your. Core Java Interview Questions _ OOPs Interview Questions - Javatpoint - Download as PDF File .pdf), Text File .txt) or read online. IQ.
|Language:||English, Spanish, Japanese|
|Genre:||Fiction & Literature|
|ePub File Size:||25.54 MB|
|PDF File Size:||9.65 MB|
|Distribution:||Free* [*Sign up for free]|
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 There are given interview questions and answers on + topics such as HR, C, C++. HR Interview Questions for beginners and professionals with a list of top frequently asked job questions with answers, hr interview questions with java,. net, php.
Parameterized constructor 7 What is static constructor? Static constructor is used to initialize static data members as soon as the class is referenced first time. Method overloading is mechanism to create multiple methods with the same name and unique signature in the same class. When you go for compilation, the compiler uses overload resolution to determine the specific method to be invoked. No Array is a set of related instances either value or reference types. It is also known as vector array. Multi Dimensional Array: It is rectangular and contains rows and columns.
Designing tests early in the life cycle prevent defects from being in the main code. There are three types of defects: Wrong, missing, and extra. Wrong: These defects are occurred due to requirements have been implemented incorrectly. Missing: It is used to specify the missing things, i. Extra: This is an extra facility incorporated into the product that was not given by the end customer. It is always a variance from the specification but may be an attribute that was desired by the customer. However, it is considered as a defect because of the variance from the user requirements.
Simultaneous test design and execution against an application is called exploratory testing. In this testing, the tester uses his domain knowledge and testing experience to predict where and under what conditions the system might behave unexpectedly. Exploratory testing is performed as a final check before the software is released. It is a complementary activity to automated regression testing.
It helps you to prevent defects in the code. The risk-based testing is a testing strategy that is based on prioritizing tests by risks. It is based on a detailed risk analysis approach which categorizes the risks by their priority. Highest priority risks are resolved first. It also validates whether the software follows a set of agreed acceptance criteria. In this level, the system is tested for the user acceptability. Types of acceptance testing are: User acceptance testing: It is also known as end-user testing.
This type of testing is performed after the product is tested by the testers. The user acceptance testing is testing performed concerning the user needs, requirements, and business processes to determine whether the system satisfies the acceptance criteria or not. Operational acceptance testing: An operational acceptance testing is performed before the product is released in the market.
But, it is performed after the user acceptance testing. Contract and regulation acceptance testing: In the case of contract acceptance testing, the system is tested against certain criteria and the criteria are made in a contract.
In the case of regulation acceptance testing, the software application is checked whether it meets the government regulations or not. Alpha and beta testing: Alpha testing is performed in the development environment before it is released to the customer. Input is taken from the alpha testers, and then the developer fixes the bug to improve the quality of a product.
Unlike alpha testing, beta testing is performed in the customer environment. Customer performs the testing and provides the feedback, which is then implemented to improve the quality of a product.
Accessibility testing is used to verify whether a software product is accessible to the people having disabilities deaf, blind, mentally disabled etc. Ad-hoc testing is a testing phase where the tester tries to 'break' the system by randomly trying the system's functionality.
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.
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? 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?
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. It is never thrown in floating-point operations.
What is a transient variable? A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization, What is synchronization? Synchronization is the capability to control the access of multiple threads to shared resources. What is the Collections API? The Collections API is a set of classes and interfaces that support operations on collections of objects.
Does garbage collection guarantee that a program will not run out of memory? 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. The immediate superclass of the Applet class? Panel is the immediate superclass. A panel provides space in which an application can attach any other component, including other panels.
Which Java operator is right associative? What is the difference between a break statement and a continue statement? A break statement results in the termination of the statement to which it applies switch, for, do, or while. A continue statement is used to end the current loop iteration and return control to the loop statement.
If a variable is declared as private, where may the variable be accessed? A private variable may only be accessed within the class in which it is declared. What is the purpose of the System class? The purpose of the System class is to provide access to system resources.
List primitive Java types? The eight primitive types are byte, char, short, int, long, float, double, and boolean. What is the relationship between clipping and repainting under AWT? When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.
Which class is the immediate superclass of the Container class? Component class is the immediate super class. What class of exceptions are generated by the Java run-time system? The Java runtime system generates RuntimeException and Error exceptions.
Under what conditions is an object's finalize method invoked by the garbage collector? The garbage collector invokes an object's finalize method when it detects that the object has become unreachable.
How can a dead thread be restarted? A dead thread cannot be restarted. Which arithmetic operations can result in the throwing of an ArithmeticException? Variable of the boolean type is automatically initialized as? The default value of the boolean type is false. Can try statements be nested? Yes What are ClassLoaders?
A class loader is an object that is responsible for loading classes. The class ClassLoader is an abstract class. What is the difference between an Interface and an Abstract class? An abstract class can have instance methods that implement a default behavior.
An Interface can only declare constants and instance methods, but cannot implement default behavior and all methods are implicitly abstract. An interface has all public members and no implementation. What will happen if static modifier is removed from the signature of the main method?
Program throws "NoSuchMethodError" error at runtime. What is the default value of an object reference declared as an instance variable? Null, unless it is defined explicitly. Can a top level class be private or protected? No, a top level class can not be private or protected. It can have either "public" or no modifier.
Why do we need wrapper classes? We can pass them around as method parameters where a method expects an object. It also provides utility methods. What is the difference between error and an exception? An error is an irrecoverable condition occurring at runtime. Such as OutOfMemory error. Exceptions are conditions that occur because of bad input etc. FileNotFoundException will be thrown if the specified file does not exist.
Is it necessary that each try block must be followed by a catch block? It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block. When a thread is created and started, what is its initial state? A thread is in the ready state as initial state after it has been created and started. What is the Locale class? The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region.
What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement. What is runtime polymorphism or dynamic method dispatch?
Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time.
In this process, an overridden method is called through the reference variable of a superclass. What is Dynamic Binding late binding? Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run-time.