ADVANCED JAVA INTERVIEW QUESTIONS PDF
In this guide we will discuss about different types of questions that can be used in a Java interview, in order for the employer to test your skills in Java and. So, job seekers go through the Advanced Java Interview Questions PDF and start their preparation according to it. “Advanced Java” is nothing. In this Java Interview Questions blog, I am going to list some of the most So let's get started with the first set of basic Java Interview Questions. a head start into Java programming and train you for both core and advanced Java concepts.
|Language:||English, Spanish, Arabic|
|Genre:||Academic & Education|
|ePub File Size:||18.38 MB|
|PDF File Size:||17.76 MB|
|Distribution:||Free* [*Regsitration Required]|
These interview questions and answers on Advanced Java will help you strengthen Interview preparation PDF was generated at Monday 12th January, Technical interview questions and answers section on "Advanced Java" with freshers can download Advanced Java quiz questions with answers as PDF files . Top 50 Advanced Java Interview Questions and Answers. In-depth guide with answers to wow the interviewer. Bonus: 20+ Videos & PDF interview guide.
The answers to a few of these are not very good. Particularly 89 - you do not need any mocking library to test a static method - just write a test for it. Unknown, not yet, but I'll surely add the PDF version which you can download for offline reading. Can't same task be achieved by using static var? Not many questions from NIO or Exception handling and data structures.
The wait , notify , and notifyAll methods are used to provide an efficient way for threads to wait for a shared resource. When a thread executes an objects wait method, it enters the waiting state.
It only enters the ready state after another thread invokes the objects notify or notifyAll methods. What is an abstract method? An abstract method is a method whose implementation is deferred to a subclass.
What is the relationship between the Canvas class and the Graphics class? A Canvas object provides access to a Graphics object via its paint method. What are the high-level thread states?
The high-level thread states are ready, running, waiting, and dead. How are Java source code files named? If no public class or interface is defined within a source code file, then the file must take on a name that is different than its classes and interfaces.
Source code files use the. What value does read return when it has reached the end of a file? The read method returns -1 when it has reached the end of a file. Can a Byte object be cast to a double value? An object cannot be cast to a primitive value.
What is the difference between a static and a non-static inner class? A non-static inner class may have object instances that are associated with instances of the classes outer class. A static inner class does not have any object instances. What is the difference between the String and StringBuffer classes? String objects are constants. StringBuffer objects are not constants. 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 an objects lock and which objects have locks? An objects lock is a mechanism that is used by multiple threads to obtain synchronized access to the object.
A thread may execute a synchronized method of an object only after it has acquired the objects lock. All objects and classes have locks. A classes lock is acquired on the classes Class object. What is the Dictionary class? The Dictionary class provides the capability to store key-value pairs.
How are the elements of a BorderLayout organized? The elements of a BorderLayout are organized at the borders North, South, East, and West and the center of a container. It is referred to as the modulo or remainder operator. It returns the remainder of dividing the first operand by the second operand.
Explain different way of using thread? The thread could be implemented by using runnable interface or by inheriting from the Thread class. The former is more advantageous, Because when you are going for multiple inheritance. Difference between Swing and Awt? AWT are heavy-weight componenets. Swings are light-weight components. Hence swing works faster than AWT.
Difference between HashMap and HashTable? The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. HashMap allows null values as key and value whereas Hashtable doesnt allow. HashMap does not guarantee that the order of the map will remain constant over time. HashMap is unsynchronized and Hashtable is synchronized. What is final? A final class cant be extended ie.
A final method cant be overridden when its class is inherited. You cant change value of a final variable is a constant. What if the main method is declared as private? What if the static modifier is removed from the signature of the main method?
Program compiles. What if I write static public void instead of public static void? Program compiles and runs properly.
What if I do not provide the String array as the argument to the method? Can I have multiple main methods in the same class? No the program fails to compile. The compiler says that the main method is already defined in the class.
Do I need to import javlang package any time? It is by default loaded internally by the JVM. Will the JVM load the package twice at runtime? One can import the same package or same class multiple times. Neither compiler nor JVM complains abt it. And the JVM will internally load the class only once no matter how many times you import the same class. What is the default value of an object reference declared as an instance variable?
When can an object reference be cast to an interface reference? An object reference be cast to an interface reference when the object implements the referenced interface.
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 class is extended by all other classes? The Object class is extended by all other classes.
Can an object be garbage collected while it is still reachable? A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected. What is the difference between the Font and FontMetrics classes? The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object. How is rounding performed under integer division? The fractional part of the result is truncated.
This is known as rounding toward zero. What happens when a thread cannot acquire a lock on an object? If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an objects lock, it enters the waiting state until the lock becomes available. What classes of exceptions may be caught by a catch clause? A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.
Advanced Java Interview Questions for Freshers and Experienced
If a class is declared without any access modifiers, where may the class be accessed? A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.
What is the SimpleTimeZone class? The SimpleTimeZone class provides support for a Gregorian calendar.
What is the Map interface? The Map interface replaces the JDK 1. Does a class inherit the constructors of its superclass? A class does not inherit constructors from any of its superclasses. For which statements does it make sense to use a label? The only statements for which it makes sense to use a label are those statements that can enclose a break or continue statement.
What is the purpose of the System class? The purpose of the System class is to provide access to system resources. Which TextComponent method is used to set a TextComponent to the read-only state?
How are the elements of a CardLayout organized? The elements of a CardLayout are stacked, one on top of the other, like a deck of cards. Name the eight primitive Java types. The eight primitive types are byte, char, short, int, long, float, double, and boolean. Which class should you use to obtain design information about an object? The Class class is used to obtain information about an objects design.
What is the relationship between clipping and repainting? When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting. It is a String object. What is the relationship between an event-listener interface and an event-adapter class? An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.
What restrictions are placed on the values of each case of a switch statement? During compilation, the values of each case of a switch statement must evaluate to a value that can be promoted to an int value.
What modifiers may be used with an interface declaration? An interface may be declared as public or abstract. What is the highest-level event class of the event-delegation model?
The javutil. EventObject class is the highest-level class in the event-delegation class hierarchy. What event results from the clicking of a button? The ActionEvent event is generated as the result of the clicking of a button.
Advanced Java Interview Questions 5. Is null a keyword? The null is not a keyword. The Vector class provides the capability to implement a growable array of objects Is sizeof a keyword? The sizeof operator is not a keyword. What is the immediate superclass of the Applet class? What is the immediate superclass of the Dialog class?
To make a class abstract we use key word abstract.
Any class that contains one or more abstract methods is declared as abstract. We get the following error. For example if we take a vehicle class we cannot provide implementation to it because there may be two wheelers , four wheelers etc.
At that moment we make vehicle class abstract. All the common features of vehicles are declared as abstract methods in vehicle class. Any class which extends vehicle will provide its method implementation. The important features of abstract classes are: Though we cannot instantiate abstract classes we can create object references. Through superclass references we can point to subclass. But when we cannot instantiate class there is no use in creating a constructor for abstract class.
Abstract method is declared with keyword abstract and semicolon in place of method body. Java Exception Handling Interview questions. NumberFormatException 3 Invalid casting of class Class cast Exception 4 Trying to create object for interface or abstract class Instantiation Exception.
In java exception is an object. Exceptions are created when an abnormal situations are arised in our program. Exceptions can be created by JVM or by our application code.
All Exception classes are defined in java. In otherwords we can say Exception as run time error. Error is the subclass of Throwable class in java. When errors are caused by our program we call that as Exception, but some times exceptions are caused due to some environment issues such as running out of memory. Exceptions which cannot be recovered are called as errors in java. Out of memory issues.
It is recommended to handle exceptions with specific Exception instead of handling with Exception root class. If a method throws an exception and it is not handled immediately, then that exception is propagated or thrown to the caller of that method. This propogation continues till it finds an appropriate exception handler ,if it finds handler it would be handled otherwise program terminates Abruptly. We can create threads in java by any of the two ways: This is first and foremost way to create threads.
By implementing runnable interface and implementing run method we can create new thread.
Method signature: If multiple threads tries to access a method where method can manipulate the state of object , in such scenario we can declare a method as synchronized. Finally block is used for cleaning up of resources such as closing connections, sockets etc.
If there is exception thrown in try block finally block executes immediately after catch block. If an exception is thrown,finally block will be executed even if the no catch block handles the exception.
From Java 7, we can catch more than one exception with single catch block. This type of handling reduces the code duplication. When we catch more than one exception in single catch block , catch parameter is implicity final.
We cannot assign any value to catch parameter. Skip to content 1. Java Interview Questions And Answers 2. What is class in Java? What is a JVM? Explain method overloading? Does Java support multiple inheritance? Read Out: Common Interview Mistakes 7. What is a transient variable? A transient variable is a variable that may not be serialized. Is null a keyword? No, the null is not a keyword. Java Interview Questions And Answers 9. These methods have been deprecated in JDK 1.
What is the immediate superclass of the Applet class? The Panel class is the immediate superclass of the Applet class. Can we rethrow the same exception from catch handler? The default value of an String type is null. Which containers use a Flow Layout as their default layout? Java Interview Questions And Answers Which java. What is the Vector class? What is a native method?
What value does read Line return when it has reached the end of a file? What is clipping?
Advanced Java Interview Questions for Freshers and Experienced
Clipping is the process of confining paint operations to a limited area or shape. Can a for statement loop indefinitely? Explain Java Coding standards for Methods? Explain Java Coding Standards for Constants? Explain Java Coding Standards for variables? Name three Component subclasses that support painting?
The Canvas, Frame, Panel, and Applet classes support painting. Java Virtual Machine For Development Purpose To execute the java programs It provides all the tools, executables and binaries required to compile, debug and execute a Java Program The execution part is handled by JVM to provide machine independence Why Java is not pure Object Oriented language? What are access modifiers?
Can we overload main method?
Advanced Java - Interview Questions and Answers
What is method in java? Can we use catch statement for checked exceptions? Explain a situation where finally block will not be executed?
- JAVA DATABASE PROGRAMMING PDF
- JAVA THE COMPLETE REFERENCE J2SE 5 EDITION.PDF
- PDF FOR JAVA LANGUAGE
- GK QUESTIONS WITH ANSWERS IN TAMIL PDF
- PREVIOUS YEAR QUESTION PAPER OF IBPS CLERK EXAM PDF
- JAVA HOW TO PROGRAM 11TH EDITION PDF
- JAVA CHEAT SHEET PDF
- CAST ON BIND OFF PDF
- EBOOK SEITEN DEUTSCH
- MCITP SELF PACED TRAINING KIT PDF
- BIOSHOCK ART BOOK
- KNIGHTS OF THE INNER SEA PDF