Java Developer Interview Questions And Answers
Question: 1. Described Heavy Weight Components Mean In Java Programming?
Answer:
Heavy weight components like Abstract Window Toolkit (AWT), depend on the nearby windowing toolkit. For instance, java.Awt.Button is a heavy weight factor, when it’s miles running at the Java platform for Unix platform, it maps to a actual Motif button. In this relationship, the Motif button is called the peer to the java.Awt.Button. If you create two Buttons, friends and consequently Motif Buttons are also created. The Java platform communicates with the Motif Buttons the usage of the Java Native Interface.
For each and every thing brought to the utility, there may be an extra overhead tied to the neighborhood windowing machine, which is why these additives are called heavyweight.
Question: 2. Can You Please Explain The Difference Between Boolean & Operator And The && Operator In Java Programming?
Answer:
If an expression involving the Boolean & operator is evaluated, each operands are evaluated. Then the & operator is implemented to the operand. When an expression involving the && operator is evaluated, the primary operand is evaluated. If the first operand returns a cost of authentic then the second one operand is evaluated. The && operator is then applied to the first and 2nd operands. If the primary operand evaluates to fake, the evaluation of the second operand is skipped.
Operator & has no danger to bypass each sides evaluation and && operator does.
HTML 4 Interview Questions
Question: 3. Does The Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
Answer:
No, it does not. It is possible for packages to use up reminiscence sources faster than they may be rubbish gathered. It is also possible for applications to create objects that are not challenge to rubbish collection.
Question: four. Described The Elements Of A Gridbaglayout Organized In Java Programming?
Answer:
The factors of a GridBagLayout are prepared according to a grid. However, the factors are of different sizes and may occupy a couple of row or column of the grid. In addition, the rows and columns can also have distinctive sizes.
HTML 4 Tutorial
Question: five. What Advantage Do Java’s Layout Managers Provide Over The Traditional Windowing Systems?
Answer:
Java makes use of format managers to put out components in a consistent way throughout all windowing platforms. Since Java’s format managers are not tied to absolute sizing and positioning, they’re capable of accommodate platform-precise differences among windowing structures.
CSS3 Interview Questions
Question: 6. How A Gui Component Handle Its Own Events In Java Programming?
Answer:
A issue can cope with its personal events by enforcing the desired event-listener interface and adding itself as its personal occasion listener.
Question: 7. Name Primitive Java Types?
Answer:
The primitive types are byte, char, short, int, long, go with the flow, double, and boolean.
CSS3 Tutorial HTML 5 Interview Questions
Question: 8. Explain The Difference Between Reader/author Class Hierarchy And The Inputstream/outputstream Class Hierarchy In Java Programming?
Answer:
The Reader/Writer magnificence hierarchy is character-oriented, and the InputStream/OutputStream elegance hierarchy is byte-orientated.
Question: 9. Does A Class Inherit Constructors Of Its Superclass In Java Programming?
Answer:
A class does now not inherit constructors from any of its superclasses.
J2EE Interview Questions
Question: 10. Define Map Interface In Java Programming?
Answer:
The Map interface replaces the JDK 1.1 Dictionary elegance and is used companion keys with values.
HTML 5 Tutorial
Question: eleven. If The A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed In Java Programming?
Answer:
A elegance this is declared without any access modifiers is stated to have bundle or pleasant get entry to. This way that the magnificence can handiest be accessed via other training and interfaces that are described inside the identical package deal.
Core Java Interview Questions
Question: 12. Which Classes Of Exceptions May Be Caught By A Catch Clause In Java Programming?
Answer:
A catch clause can capture any exception that may be assigned to the Throwable kind. This includes the Error and Exception kinds.
HTML four Interview Questions
Question: thirteen. Can You Please Explain The Difference Between Preemptive Scheduling And Time Slicing In Java Programming?
Answer:
Under preemptive scheduling, the very best priority venture executes until it enters the ready or lifeless states or a higher priority venture comes into lifestyles. Under time slicing, a mission executes for a predefined slice of time after which reenters the pool of equipped responsibilities. The scheduler then determines which challenge should execute subsequent, based on precedence and different factors.
J2EE Tutorial
Question: 14. What Happens When A Thread Cannot Acquire Lock On An Object In Java Programming?
Answer:
If a thread tries to execute a synchronized technique or synchronized assertion and is unable to acquire an item’s lock, it enters the ready nation until the lock turns into available.
Question: 15. Can You Please Explain The Difference Between Font And Fontmetrics Classes In Java Programming?
Answer:
The FontMetrics elegance is used to define implementation-precise properties, such as ascent and descent, of a Font object.
JSP Interview Questions
Question: 16. What Are Peerless Components?
Answer:
The peerless additives are referred to as light weight components.
Core Java Tutorial
Question: 17. Which Package Has The Light Weight Components In Java Programming?
Answer:
javax.Swing bundle. All additives in Swing, except JApplet, JDialog, JFrame and JWindow are light-weight additives in Java Programming.
Android Interview Questions
Question: 18. When An Object Reference Be Cast To An Interface Reference In Java Programming?
Answer:
An object reference be solid to an interface reference while the item implements the referenced interface.
CSS3 Interview Questions
Question: 19. Can You Please Explain The Difference Between Window And A Frame In Java Programming?
Answer:
The Frame class extends Window to define a first-rate utility window that could have a menu bar.
JSP Tutorial
Question: 20. Can You Please Explain The Difference Between Static And A Non-static Inner Class In Java Programming?
Answer:
A non-static inner class can also have item instances which are related to times of the class’s outer elegance. A static internal magnificence does not have any item instances.
Hibernate Interview Questions
Question: 21. Described Object’s Lock And Which Object’s Have Locks In Java Programming?
Answer:
An object’s lock is a mechanism that is used by multiple threads to achieve synchronized get right of entry to to the item. A thread may also execute a synchronized approach of an object handiest after it has acquired the object’s lock. All items and instructions have locks. A magnificence’s lock is acquired on the magnificence’s Class object.
Question: 22. Described Abstract Method In Java Programming?
Answer:
An abstract approach is a method whose implementation is deferred to a subclass in Java Programming.
Android Tutorial
Question: 23. What Are High-stage Thread States In Java Programming?
Answer:
The high-stage thread states are equipped, running, waiting, and dead.
Java Swing Interview Questions
Question: 24. What Must Class Do To Implement An Interface In Java Programming?
Answer:
It ought to provide all the techniques within the interface and perceive the interface in its implements clause.
HTML five Interview Questions
Question: 25. Described The Purpose Of The Wait(), Notify(), And Notifyall() Methods In Java Programming?
Answer:
The wait(),notify(), and notifyAll() methods are used to offer an efficient way for threads to communicate every different in Java Programming.
Hibernate Tutorial
Question: 26. What Is The Purpose Of Finally Clause Of A Try-capture-subsequently Statement In Java Programming?
Answer:
The subsequently clause is used to provide the functionality to execute code regardless of whether or now not an exception is thrown or caught.
Java collections framework Interview Questions
Question: 27. Described Locale Class In Java Programming?
Answer:
The Locale class is used to tailor program output to the conventions of a selected geographic, political, or cultural region.
J2EE Interview Questions
Question: 28. What Is The Purpose Of Runtime Class In Java Programming?
Answer:
The reason of the Runtime class is to provide get admission to to the Java runtime device in Java Programming.
Java Swing Tutorial
Question: 29. Described The Purpose Of System Class In Java Programming?
Answer:
The purpose of the System magnificence is to provide access to device sources in Java Programming.
Question: 30. Which Container Method Is Used To Cause Container To Be Laid Out And Redisplayed In Java Programming?
Answer:
validate(); : Container method is used to motive a box to be laid out and redisplayed in Java Programming.
Question: 31. Described Properties Class In Java Programming?
Answer:
The residences magnificence is a subclass of Hashtable that may be read from or written to a flow. It additionally presents the functionality to specify a hard and fast of default values to be used.
Question: 32. Described Gregorian Calendar Class In Java Programming?
Answer:
The GregorianCalendar gives guide for traditional Western calendars in Java Programming.
Question: 33. What Is Simpletimezone Class In Java Programming?
Answer:
The SimpleTimeZone class offers support for a Gregorian calendar in Java Programming.
Core Java Interview Questions
Question: 34. Which Invokes A Thread’s Run() Method In Java Programming?
Answer:
After a thread is started out, thru its begin() method or that of the Thread class, the JVM invokes the thread’s run() approach whilst the thread is to begin with completed.
Question: 35. Can Anonymous Class Be Declared As Implementing An Interface And Extending A Class In Java Programming?
Answer:
An anonymous class may additionally put into effect an interface or increase a superclass, but might not be declared to do both.
Question: 36. What Is Purpose Of Finalization In Java Programming?
Answer:
The reason of finalization is to present an unreachable item the opportunity to carry out any cleanup processing earlier than the object is garbage amassed.
JSP Interview Questions
Question: 37. Which Class Is Superclass For Every Class In Java Programming?
Answer:
Object class is the superclass for every class in Java Programming.
Question: 38. Which Component Subclasses That Support Painting In Java Programming?
Answer:
The Canvas, Frame, Panel, and Applet instructions guide portray.
Question: 39. Described Native Method In Java Programming?
Answer:
A native method is a way that is carried out in a language apart from Java.
Question: forty. How To Write A Loop Indefinitely In Java Programming?
Answer:
for(;;)-for loop; at the same time as(proper)-constantly actual, and so on.
Android Interview Questions
Question: forty one. How Many Bits Are Used To Represent The Unicode, Ascii, Utf-sixteen, And Utf-8 Characters In Java Programming?
Answer:
Unicode requires sixteen bits and ASCII require 7 bits. Although the ASCII individual set makes use of only 7 bits, it is also represented as eight bits. UTF-eight represents characters using eight, 16, and 18 bit styles. UTF-16 uses 16-bit and large bit patterns.
Question: forty two. Can You Please Explain The Difference Between Yielding And Sleeping In Java Programming?
Answer:
When a task invokes its yield() method, it returns to the equipped kingdom. When a undertaking invokes its sleep() method, it returns to the waiting kingdom.
Hibernate Interview Questions
Question: 43. Is The Size Of A Keyword In Java Programming?
Answer:
The sizeof operator is not a keyword in Java Programming.
Question: 44. Described Wrapped Classes In Java Programming?
Answer:
Wrapped classes are classes that permit primitive kinds to be accessed as items.
Question: forty five. Does Java Handle Integer Overflows And Underflows?
Answer:
It uses the ones low order bytes of the result that could healthy into the scale of the sort allowed via the operation.
Question: 46. What Is Vector Class In Java Programming?
Answer:
The Vector class in Java Programming offers the functionality to implement a growable array of objects.
Question: forty seven. Which Modifiers May Be Used With An Inner Class That Is A Member Of An Outer Class In Java Programming?
Answer:
A (non-nearby) inner elegance may be declared as public, protected, private, static, very last, or abstract.
Question: forty eight. Suppose If A Method Is Declared As Protected, Where May The Method Be Accessed In Java Programming?
Answer:
A included method might also most effective be accessed via instructions or interfaces of the same package deal or through subclasses of the magnificence wherein it’s far declared.
Question: forty nine. What Is Iterator Interface In Java Programming?
Answer:
The Iterator interface is used to step through the factors of a Collection.
Question: 50. Which Containers Is Use A Border Layout As Their Default Layout?
Answer:
The window, Frame and Dialog lessons use a border layout as their default layout in Java Programming.
Question: fifty one. Which Method Is Used To Specify A Container’s Layout In Java Programming?
Answer:
The setLayout() technique is used to specify a field’s format in Java Programming.
Question: 52. Which State Does A Thread Enter When It Terminates Its Processing In Java Programming?
Answer:
When a thread terminates its processing, it enters the dead state.
Question: fifty three. What Is Collections Api In Java Programming?
Answer:
The Collections API is a hard and fast of training and interfaces that assist operations on collections of objects.
Question: 54. Define Llist Interface In Java Programming?
Answer:
The List interface provides assist for ordered collections of items.
Question: 55. Can A Lock Be Acquired On Class In Java Programming?
Answer:
Yes, a lock can be received on a category. This lock is received on the elegance’s Class object.
Question: 56. Which Containers Use Flowlayout As Their Default Layout In Java Programming?
Answer:
The Panel and Applet instructions use the FlowLayout as their default layout.
Question: fifty seven. Described Transient Variable?
Answer:
A transient variable is a variable that won’t be serialized.
Question: 58. What’s New With Stop(), Suspend() And Resume() Methods In Jdk 1.2?
Answer:
The stop(), droop() and resume() strategies have been deprecated in JDK 1.2.
Question: fifty nine. Define Preferred Size Of A Component In Java Programming?
Answer:
The preferred size of a component is the minimum aspect length on the way to allow the element to show usually.
Question: 60. Which Three Ways In Which A Thread Can Enter The Waiting State In Java Programming?
Answer:
A thread can input the waiting country via invoking its sleep() approach, via blocking off on I/O, with the aid of unsuccessfully attempting to accumulate an object’s lock, or by invoking an item’s wait() technique. It also can input the ready nation via invoking its (deprecated) suspend() technique.
Question: 61. Described Synchronized Methods And Synchronized Statements In Java Programming?
Answer:
Synchronized strategies are strategies that are used to control get admission to to an object. A thread simplest executes a synchronized method after it has acquired the lock for the approach’s item or magnificence. Synchronized statements are much like synchronized techniques. A synchronized declaration can handiest be achieved after a thread has received the lock for the object or class referenced in the synchronized announcement.
Question: sixty two. Described Synchronization And Why Is It Important In Java Programming?
Answer:
With respect to multithreading, synchronization is the capability to manipulate the get right of entry to of multiple threads to shared resources. Without synchronization, it’s miles possible for one thread to alter a shared object while every other thread is inside the process of the use of or updating that object’s price. This regularly causes grimy information and results in enormous errors.
Question: sixty three. How Observer And Observable Used In Java Programming?
Answer:
Objects that subclass the Observable magnificence maintain a listing of observers. When an Observable item is updated it invokes the update() approach of every of its observers to inform the observers that it has modified state. The Observer interface is applied with the aid of items that look at Observable items.
