YouTube Icon

Interview Questions.

Top 100+ Adv Java Interview Questions And Answers - May 26, 2020

fluid

Top 100+ Adv Java Interview Questions And Answers

Question 1. What Is A Transient Variable?

Answer :

A temporary variable is a variable that won't be serialized.

Question 2. Which Containers Use A Border Layout As Their Default Layout?

Answer :

The Window, Frame and Dialog instructions use a border format as their default layout.

Core Java Interview Questions
Question 3. Why Do Threads Block On I/o?

Answer :

Threads block on I/O (that is enters the waiting nation) in order that different threads may also execute while the I/O Operation is performed.

Question 4. How Are Observer And Observable Used?

Answer :

Objects that subclass the Observable elegance preserve a listing of observers. When an Observable object is updated it invokes the update() technique of each of its observers to inform the observers that it has modified kingdom. The Observer interface is applied via gadgets that have a look at Observable objects.

Core Java Tutorial
Question five. What Is Synchronization And Why Is It Important?

Answer :

With admire to multithreading, synchronization is the capability to govern the access of multiple threads to shared assets. Without synchronization, it's miles possible for one thread to alter a shared item while another thread is in the technique of using or updating that item's value. This often leads to significant mistakes.

HTML+Javascript Interview Questions
Question 6. Can A Lock Be Acquired On A Class?

Answer :

Yes, a lock may be received on a category. This lock is acquired on the magnificence's Class item..

Question 7. What's New With The Stop(), Suspend() And Resume() Methods In Jdk 1.2?

Answer :

The forestall(), suspend() and resume() techniques were deprecated in JDK 1.2.

Java Tutorial Java Liferay Interview Questions
Question eight. Is Null A Keyword?

Answer :

The null is not a key-word.

Question nine. What Is The Preferred Size Of A Component?

Answer :

The preferred length of a element is the minimum component length to be able to permit the component to show generally.

Java Persistence API Interview Questions
Question 10. What Method Is Used To Specify A Container's Layout?

Answer :

The setLayout() approach is used to specify a container's format.

JavaMail API Tutorial
Question 11. Which Containers Use A Flowlayout As Their Default Layout?

Answer :

The Panel and Applet classes use the FlowLayout as their default format.

Java Interview Questions
Question 12. What State Does A Thread Enter When It Terminates Its Processing?

Answer :

When a thread terminates its processing, it enters the useless state.

Core Java Interview Questions
Question 13. What Is The Collections Api?

Answer :

The Collections API is a fixed of training and interfaces that guide operations on collections of gadgets.

Java eight Tutorial
Question 14. Which Characters May Be Used As The Second Character Of An Identifier, But Not As The First Character Of An Identifier?

Answer :

The digits 0 thru nine might not be used as the first character of an identifier however they will be used after the primary individual of an identifier.

Question 15. What Is The List Interface?

Answer :

The List interface gives support for ordered collections of gadgets.

JavaMail API Interview Questions
Question sixteen. How Does Java Handle Integer Overflows And Underflows?

Answer :

It uses the ones low order bytes of the result that can in shape into the scale of the sort allowed with the aid of the operation.

Question 17. What Is The Vector Class?

Answer :

The Vector magnificence gives the capability to put in force a growable array of gadgets.

Java collections framework Interview Questions
Question 18. What Modifiers May Be Used With An Inner Class That Is A Member Of An Outer Class?

Answer :

A (non-nearby) inner magnificence can be declared as public, blanketed, non-public, static, very last, or summary.

HTML+Javascript Interview Questions
Question 19. What Is An Iterator Interface?

Answer :

The Iterator interface is used to step via the elements of a Collection.

Question 20. What Is The Difference Between The >> And >>> Operators?

Answer :

The >> operator includes the sign bit whilst moving right. The >>> 0-fills bits which have been shifted out.

Java 8 Interview Questions
Question 21. Which Method Of The Component Class Is Used To Set The Position And Size Of A Component?

Answer :

setBounds() approach is used to set the position and size of a issue.

Question 22. What Is The Difference Between Yielding And Sleeping?

Answer :

When a undertaking invokes its yield() approach, it returns to the ready kingdom. When a project invokes its sleep() technique, it returns to the waiting state.

Question 23. Which Java.Util Classes And Interfaces Support Event Handling?

Answer :

The EventObject class and the EventListener interface support event processing.

Angular 5 Interview Questions
Question 24. Is Sizeof A Keyword?

Answer :

The sizeof operator isn't a key-word.

Java Liferay Interview Questions
Question 25. What Are Wrapped Classes?

Answer :

Wrapped instructions are classes that permit primitive types to be accessed as gadgets.

Question 26. Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?

Answer :

Garbage collection does not guarantee that a program will no longer run out of memory. It is viable for applications to dissipate reminiscence sources faster than they may be rubbish collected. It is likewise viable for packages to create items that are not problem to rubbish collection.

Java Hadoop Developer Interview Questions
Question 27. What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?

Answer :

A package statement ought to appear because the first line in a supply code record (aside from blank strains and comments).

Java Persistence API Interview Questions
Question 28. Can An Object's Finalize() Method Be Invoked While It Is Reachable?

Answer :

An item's finalize() approach can not be invoked by the rubbish collector at the same time as the object is still available. However, an object's finalize() method may be invoked with the aid of other objects.

Question 29. What Is The Immediate Superclass Of The Applet Class?

Answer :

Panel.

Question 30. What Is The Difference Between Preemptive Scheduling And Time Slicing?

Answer :

Under preemptive scheduling, the very best priority mission executes till it enters the waiting or useless states or a better precedence task comes into life. Under time cutting, a task executes for a predefined slice of time and then reenters the pool of equipped obligations.
The scheduler then determines which challenge ought to execute subsequent, based on priority and different factors.

Question 31. Name Three Component Subclasses That Support Painting.

Answer :

The Canvas, Frame, Panel, and Applet instructions assist painting.

Question 32. What Value Does Readline() Return When It Has Reached The End Of A File?

Answer :

The readLine() method returns null while it has reached the stop of a file.

Question 33. What Is The Immediate Superclass Of The Dialog Class?

Answer :

Window.

Java Interview Questions
Question 34. What Is Clipping?

Answer :

Clipping is the process of confining paint operations to a restrained area or form.

Question 35. What Is A Native Method?

Answer :

A native approach is a method this is applied in a language other than Java.

Question 36. Can A For Statement Loop Indefinitely?

Answer :

Yes, a for announcement can loop indefinitely. For instance, consider the following:
for(;;) ;

JavaMail API Interview Questions
Question 37. What Are Order Of Precedence And Associativity, And How Are They Used?

Answer :

Order of precedence determines the order in which operators are evaluated in expressions.

Associatity determines whether an expression is evaluated left-to-right or proper-to-left.

Question 38. When A Thread Blocks On I/o, What State Does It Enter?

Answer :

A thread enters the ready nation while it blocks on I/O.

Question 39. To What Value Is A Variable Of The String Type Automatically Initialized?

Answer :

The default fee of an String kind is null.

Question 40. What Is The Catch Or Declare Rule For Method Declarations?

Answer :

If a checked exception can be thrown inside the body of a way, the technique ought to both seize the exception or declare it in its throws clause.

Java collections framework Interview Questions
Question forty one. What Is The Difference Between A Menuitem And A Checkboxmenuitem?

Answer :

The CheckboxMenuItem magnificence extends the MenuItem magnificence to support a menu item that may be checked or unchecked.

Question 42. What Is A Task's Priority And How Is It Used In Scheduling?

Answer :

A venture's precedence is an integer fee that identifies the relative order in which it need to be done with respect to other obligations. The scheduler attempts to agenda better precedence obligations before decrease priority tasks.

Java eight Interview Questions
Question 43. What Class Is The Top Of The Awt Event Hierarchy?

Answer :

The java.Awt.AWTEvent magnificence is the very best-level class in the AWT occasion-elegance hierarchy.

Question 44. When A Thread Is Created And Started, What Is Its Initial State?

Answer :

A thread is in the prepared country after it has been created and started out.

Question 45. Can An Anonymous Class Be Declared As Implementing An Interface And Extending A Class?

Answer :

An nameless class may additionally implement an interface or extend a superclass, however might not be declared to do each.

Question 46. What Is The Immediate Superclass Of Menu?

Answer :

MenuItem.

Question forty seven. What Is The Purpose Of Finalization?

Answer :

The purpose of finalization is to offer an unreachable object the opportunity to perform any cleanup processing earlier than the object is garbage collected.

Question forty eight. Which Class Is The Immediate Superclass Of The Menucomponent Class?

Answer :

Object.

Question forty nine. What Invokes A Thread's Run() Method?

Answer :

After a thread is commenced, thru its begin() approach or that of the Thread elegance, the JVM invokes the thread's run() approach while the thread is initially accomplished.

Question 50. What Is The Difference Between The Boolean & Operator And The && Operator?

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 regarding the && operator is evaluated, the primary operand is evaluated.

If the first operand returns a fee of true then the second one operand is evaluated. The && operator is then applied to the first and 2nd operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.

Question fifty one. Name Three Subclasses Of The Component Class.

Answer :

Box.Filler, Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, or TextComponent.

Question fifty two. What Is The Gregoriancalendar Class?

Answer :

The GregorianCalendar elegance presents support for classic Western calendars.

Question fifty three. Which Container Method Is Used To Cause A Container To Be Laid Out And Redisplayed?

Answer :

validate() technique is used to motive a container to be laid out and redisplayed.

Question fifty four. What Is The Purpose Of The Runtime Class?

Answer :

The reason of the Runtime class is to provide access to the Java runtime system.

Question fifty five. How Many Times May An Object's Finalize() Method Be Invoked By The Garbage Collector?

Answer :

An item's finalize() approach may additionally best be invoked once via the rubbish collector.

Question 56. What Is The Purpose Of The Finally Clause Of A Try-capture-in the end Statement?

Answer :

The finally clause is used to offer the functionality to execute code irrespective of whether or no longer an exception is thrown or stuck.

Question 57. What Is The Argument Type Of A Program's Main() Method?

Answer :

A program's primary() technique takes a controversy of the String[] kind.

Question 58. Which Java Operator Is Right Associative?

Answer :

The = operator is right associative.

Question 59. Can A Double Value Be Cast To A Byte?

Answer :

Yes, a double price may be solid to a byte.

Question 60. What Must A Class Do To Implement An Interface?

Answer :

It need to offer all the methods in the interface and discover the interface in its implements clause.

Question sixty one. What Method Is Invoked To Cause An Object To Begin Executing As A Separate Thread?

Answer :

The begin() method of the Thread elegance is invoked to purpose an object to begin executing as a separate thread.

Question 62. Name Two Subclasses Of The Textcomponent Class.

Answer :

TextField and TextArea.

Question sixty three. Which Containers May Have A Menubar?

Answer :

Frame.

Question sixty four. How Are Commas Used In The Intialization And Iteration Parts Of A For Statement?

Answer :

Commas are used to separate multiple statements in the initialization and generation components of a for assertion.

Question 65. What Is The Purpose Of The Wait(), Notify(), And Notifyall() Methods?

Answer :

The wait(), notify(), and notifyAll() methods are used to offer an efficient way for threads to wait for a shared useful resource. When a thread executes an item's wait() method, it enters the ready nation. It handiest enters the geared up state after every other thread invokes the object's notify() or notifyAll() strategies..

Question 66. What Is An Abstract Method?

Answer :

An summary approach is a technique whose implementation is deferred to a subclass.

Question sixty seven. How Are Java Source Code Files Named?

Answer :

A Java source code document takes the name of a public magnificence or interface that is defined within the record. A source code report might also incorporate at most one public class or interface. If a public elegance or interface is defined within a source code file, then the source code report ought to take the call of the general public elegance or interface.

If no public class or interface is defined inside a supply code file, then the file should take on a call that is different than its training and interfaces. Source code documents use the .Java extension.

Question sixty eight. What Is The Relationship Between The Canvas Class And The Graphics Class?

Answer :

A Canvas object affords get right of entry to to a Graphics item through its paint() approach.

Question 69. What Are The High-stage Thread States?

Answer :

The high-stage thread states are equipped, jogging, waiting, and useless.

Question 70. What Value Does Read() Return When It Has Reached The End Of A File?

Answer :

The read() method returns -1 while it has reached the stop of a report.

Question seventy one. Can A Byte Object Be Cast To A Double Value?

Answer :

No. An object cannot be cast to a primitive fee.

Question seventy two. What Is The Difference Between A Static And A Non-static Inner Class?

Answer :

A non-static inner elegance may additionally have item times which might be associated with times of the magnificence's outer magnificence.

A static internal magnificence does now not have any object times.

Question 73. What Is The Difference Between The String And Stringbuffer Classes?

Answer :

String items are constants. StringBuffer gadgets are not constants.

Question 74. If A Variable Is Declared As Private, Where May The Variable Be Accessed?

Answer :

A personal variable may additionally handiest be accessed inside the class wherein it's far declared.

Question 75. What Is An Object's Lock And Which Object's Have Locks?

Answer :

An object's lock is a mechanism that is utilized by more than one threads to attain synchronized get entry to to the item. A thread may execute a synchronized approach of an item best after it has acquired the object's lock.

All items and lessons have locks. A class's lock is received on the magnificence's Class item.

Question 76. What Is The Dictionary Class?

Answer :

The Dictionary class gives the functionality to save key-fee pairs.

Question seventy seven. How Are The Elements Of A Borderlayout Organized?

Answer :

The elements of a BorderLayout are prepared at the borders (North, South, East, and West) and the middle of a box.

Question seventy eight. What Is The % Operator?

Answer :

It is referred to as the modulo or the rest operator. It returns the remainder of dividing the first operand through the second operand.

Question 79. When Can An Object Reference Be Cast To An Interface Reference?

Answer :

An object reference be forged to an interface reference when the item implements the referenced interface.

Question 80. What Is The Difference Between A Window And A Frame?

Answer :

The Frame elegance extends Window to define a prime software window that could have a menu bar.

Question eighty one. Which Class Is Extended By All Other Classes?

Answer :

The Object magnificence is prolonged via all different instructions.

Question 82. Can An Object Be Garbage Collected While It Is Still Reachable?

Answer :

A reachable item cannot be rubbish gathered. Only unreachable gadgets may be rubbish collected..

Question eighty three. Is The Ternary Operator Written X : Y ? Z Or X ? Y : Z ?

Answer :

It is written x ? Y : z.

Question eighty four. What Is The Difference Between The Font And Fontmetrics Classes?

Answer :

The FontMetrics elegance is used to define implementation-specific residences, such as ascent and descent, of a Font object.

Question eighty five. How Is Rounding Performed Under Integer Division?

Answer :

The fractional part of the result is truncated. This is called rounding in the direction of 0.

Question 86. What Happens When A Thread Cannot Acquire A Lock On An Object?

Answer :

If a thread tries to execute a synchronized method or synchronized assertion and is not able to acquire an object's lock, it enters the ready country till the lock will become to be had.

Question 87. What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?

Answer :

The Reader/Writer class hierarchy is man or woman-oriented, and the InputStream/OutputStream elegance hierarchy is byte-orientated.

Question 88. What Classes Of Exceptions May Be Caught By A Catch Clause?

Answer :

A catch clause can catch any exception that may be assigned to the Throwable kind. This includes the Error and Exception kinds.

Question 89. If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?

Answer :

A class that is declared with none get entry to modifiers is stated to have package deal get right of entry to. This approach that the class can most effective be accessed by means of other training and interfaces which might be described inside the equal bundle.

Question 90. What Is The Simpletimezone Class?

Answer :

The SimpleTimeZone elegance gives support for a Gregorian calendar.

Question ninety one. What Is The Map Interface?

Answer :

The Map interface replaces the JDK 1.1 Dictionary magnificence and is used associate keys with values.

Question 92. Does A Class Inherit The Constructors Of Its Superclass?

Answer :

A class does not inherit constructors from any of its superclasses.

Question ninety three. For Which Statements Does It Make Sense To Use A Label?

Answer :

The only statements for which it makes experience to use a label are the ones statements which could enclose a destroy or hold statement.

Question 94. What Is The Purpose Of The System Class?

Answer :

The cause of the System elegance is to provide access to system assets.

Question ninety five. Which Textcomponent Method Is Used To Set A Textcomponent To The Read-only State?

Answer :

setEditable().

Question 96. How Are The Elements Of A Cardlayout Organized?

Answer :

The elements of a CardLayout are stacked, one on pinnacle of the opposite, like a deck of cards.

Question 97. Is &&= A Valid Java Operator?

Answer :

No. It is not a legitimate java operator.

Question ninety eight. Name The Eight Primitive Java Types.

Answer :

The 8 primitive types are byte, char, short, int, lengthy, waft, double, and boolean.

Question 99. Which Class Should You Use To Obtain Design Information About An Object?

Answer :

The Class magnificence is used to achieve statistics about an item's layout.

Question a hundred. What Is The Relationship Between Clipping And Repainting?

Answer :

When a window is repainted by using the AWT portray thread, it units the clipping areas to the vicinity of the window that calls for repainting.

Question a hundred and one. Is "abc" A Primitive Value?

Answer :

The String literal "abc" isn't always a primitive price. It is a String object.

Question 102. What Is The Relationship Between An Event-listener Interface And An Event-adapter Class?

Answer :

An event-listener interface defines the strategies that ought to be implemented through an occasion handler for a specific type of event.

An event adapter affords a default implementation of an occasion-listener interface.

Question 103. What Restrictions Are Placed On The Values Of Each Case Of A Switch Statement?

Answer :

During compilation, the values of each case of a transfer announcement ought to evaluate to a price that may be promoted to an int value.

Question 104. What Modifiers May Be Used With An Interface Declaration?

Answer :

An interface may be declared as public or summary.

Question one hundred and five. Is A Class A Subclass Of Itself?

Answer :

A class is a subclass of itself.

Question 106. What Is The Highest-level Event Class Of The Event-delegation Model?

Answer :

The java.Util.EventObject magnificence is the best-degree elegance inside the occasion-delegation class hierarchy.

Question 107. What Event Results From The Clicking Of A Button?

Answer :

The ActionEvent occasion is generated as the result of the clicking of a button.

Question 108. How Can A Gui Component Handle Its Own Events?

Answer :

A issue can cope with its very own occasions by enforcing the required occasion-listener interface and adding itself as its own event listener.

Question 109. How Are The Elements Of A Gridbaglayout Organized?

Answer :

The elements of a GridBagLayout are organized in step with a grid. However, the factors are of different sizes and can occupy a couple of row or column of the grid. In addition, the rows and columns may also have special sizes.

Question 110. What Advantage Do Java's Layout Managers Provide Over Traditional Windowing Systems?

Answer :

Java uses layout managers to put out components in a consistent way across all windowing structures. Since Java's format managers aren't tied to absolute sizing and positioning, they're able to accomodate platform-particular variations amongst windowing systems.

Question 111. What Is The Collection Interface?

Answer :

The Collection interface provides support for the implementation of a mathematical bag - an unordered series of gadgets that may contain duplicates.

Question 112. What Modifiers Can Be Used With A Local Inner Class?

Answer :

A local inner class can be very last or summary.

Question 113. What Is The Difference Between Static And Non-static Variables?

Answer :

A static variable is related to the class as a whole instead of with specific times of a category.

Non-static variables take on particular values with every item instance.

Question 114. What Is The Difference Between The Paint() And Repaint() Methods?

Answer :

The paint() technique supports painting thru a Graphics item. The repaint() approach is used to cause paint() to be invoked by way of the AWT painting thread.

Question one hundred fifteen. What Is The Purpose Of The File Class?

Answer :

The File class is used to create items that provide get entry to to the files and directories of a local document device.

Question 116. Can An Exception Be Rethrown?

Answer :

Yes, an exception may be rethrown.

Question 117. Which Math Method Is Used To Calculate The Absolute Value Of A Number?

Answer :

The abs() method is used to calculate absolute values.

Question 118. How Does Multithreading Take Place On A Computer With A Single Cpu?

Answer :

The working device's undertaking scheduler allocates execution time to more than one responsibilities. By fast switching among executing obligations, it creates the impression that tasks execute sequentially.

Question 119. When Does The Compiler Supply A Default Constructor For A Class?

Answer :

The compiler materials a default constructor for a category if no other constructors are supplied.

Question one hundred twenty. When Is The Finally Clause Of A Try-seize-in the end Statement Executed?

Answer :

The subsequently clause of the try-seize-eventually assertion is constantly performed except the thread of execution terminates or an exception happens within the execution of the eventually clause.

Question 121. Which Class Is The Immediate Superclass Of The Container Class?

Answer :

Component.

Question 122. If A Method Is Declared As Protected, Where May The Method Be Accessed?

Answer :

A included method may additionally simplest be accessed through training or interfaces of the same bundle or by subclasses of the magnificence wherein it is declared.

Question 123. How Can The Checkbox Class Be Used To Create A Radio Button?

Answer :

By associating Checkbox gadgets with a CheckboxGroup.

Question 124. Which Non-unicode Letter Characters May Be Used As The First Character Of An Identifier?

Answer :

The non-Unicode letter characters $ and _ may appear because the first person of an identifier

Question 125. What Restrictions Are Placed On Method Overloading?

Answer :

Two techniques might not have the identical call and argument listing but unique return types.

Question 126. What Happens When You Invoke A Thread's Interrupt Method While It Is Sleeping Or Waiting?

Answer :

When a project's interrupt() approach is accomplished, the undertaking enters the ready kingdom. The subsequent time the assignment enters the strolling state, an InterruptedException is thrown.

Question 127. What Is Casting?

Answer :

There are  forms of casting, casting among primitive numeric types and casting among item references.

Casting between numeric types is used to convert larger values, including double values, to smaller values, consisting of byte values.

Casting among item references is used to consult an item through a compatible class, interface, or array type reference.

Question 128. What Is The Return Type Of A Program's Main() Method?

Answer :

A software's fundamental() technique has a void go back kind.

Question 129. Name Four Container Classes.

Answer :

Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane.

Question a hundred thirty. What Is The Difference Between A Choice And A List?

Answer :

A Choice is displayed in a compact shape that requires you to drag it right down to see the list of to be had selections. Only one object can be selected from a Choice.

A List can be displayed in such a manner that several List objects are seen. A List helps the choice of 1 or greater List gadgets.

Question 131. What Class Of Exceptions Are Generated By The Java Run-time System?

Answer :

The Java runtime gadget generates RuntimeException and Error exceptions.

Question 132. What Class Allows You To Read Objects Directly From A Stream?

Answer :

The ObjectInputStream elegance supports the studying of objects from enter streams.

Question 133. What Is The Difference Between A Field Variable And A Local Variable?

Answer :

A subject variable is a variable that is declared as a member of a class.

A local variable is a variable that is declared nearby to a way.

Question 134. Under What Conditions Is An Object's Finalize() Method Invoked By The Garbage Collector?

Answer :

The garbage collector invokes an item's finalize() method whilst it detects that the item has emerge as unreachable.

Question 135. What Is The Relationship Between A Method's Throws Clause And The Exceptions That Can Be Thrown During The Method's Execution?

Answer :

A method's throws clause need to claim any checked exceptions that are not caught inside the frame of the method.

Question 136. What Is The Difference Between The Jdk 1.02 Event Model And The Event-delegation Model Introduced With Jdk 1.1?

Answer :

The JDK 1.02 occasion model makes use of an event inheritance or bubbling method. In this version, additives are required to deal with their very own occasions. If they do now not take care of a particular occasion, the occasion is inherited by using (or bubbled as much as) the element's box. The container then both handles the occasion or it's far bubbled up to its box and so on, until the very best-degree box has been tried.

In the occasion-delegation model, specific gadgets are unique as occasion handlers for GUI components. These items put in force event-listener interfaces. The event-delegation version is more efficient than the event-inheritance model as it eliminates the processing required to aid the bubbling of unhandled occasions.

Question 137. How Is It Possible For Two String Objects With Identical Values Not To Be Equal Under The == Operator?

Answer :

The == operator compares  objects to decide if they're the same item in memory. It is possible for 2 String items to have the same price, however positioned detached areas of memory.

Question 138. Why Are The Methods Of The Math Class Static?

Answer :

So they may be invoked as though they're a mathematical code library.

Question 139. What Checkbox Method Allows You To Tell If A Checkbox Is Checked?

Answer :

getState().

Question 140. What State Is A Thread In When It Is Executing?

Answer :

An executing thread is within the going for walks nation.

Question 141. What Are The Legal Operands Of The Instanceof Operator?

Answer :

The left operand is an object reference or null fee and the right operand is a category, interface, or array kind.

Question 142. What An I/o Filter?

Answer :

An I/O clear out is an object that reads from one circulate and writes to some other, normally altering the statistics in a few way as it's miles handed from one flow to every other.

Question 143. If An Object Is Garbage Collected, Can It Become Reachable Again?

Answer :

Once an object is garbage gathered, it ceases to exist. It can now not turn out to be reachable once more.

Question a hundred and forty four. What Is The Set Interface?

Answer :

The Set interface offers techniques for gaining access to the elements of a finite mathematical set. Sets do not permit duplicate elements.

Question 145. What Classes Of Exceptions May Be Thrown By A Throw Statement?

Answer :

A throw assertion can also throw any expression that may be assigned to the Throwable kind.

Question 146. What Are E And Pi?

Answer :

E is the base of the natural logarithm and PI is mathematical value pi.

Question 147. Are True And False Keywords?

Answer :

The values true and fake aren't keywords.

Question 148. What Is A Void Return Type?

Answer :

A void return kind indicates that a technique does no longer return a cost.

Question 149. What Is The Purpose Of The Enableevents() Method?

Answer :

The enableEvents() technique is used to permit an occasion for a selected item. Normally, an event is enabled when a listener is brought to an item for a particular occasion.

The enableEvents() technique is used by gadgets that manage occasions with the aid of overriding their occasion-dispatch strategies.

Question one hundred fifty. What Is The Difference Between The File And Randomaccessfile Classes?

Answer :

The File class encapsulates the documents and directories of the local file gadget.

The RandomAccessFile elegance presents the methods had to at once get entry to statistics contained in any part of a record.

Question 151. What Happens When You Add A Double Value To A String?

Answer :

The result is a String object.

Question 152. What Is Your Platform's Default Character Encoding?

Answer :

If you're running Java on English Windows platforms, it is probably Cp1252. If you are going for walks Java on English Solaris structures, it's far maximum possibly 8859_1.

Question 153. Which Package Is Always Imported By Default?

Answer :

The java.Lang package deal is continually imported with the aid of default.

Question 154. What Interface Must An Object Implement Before It Can Be Written To A Stream As An Object?

Answer :

An item have to put in force the Serializable or Externalizable interface before it could be written to a circulation as an object.

Question 155. How Are This And Super Used?

Answer :

that is used to consult the present day item instance.

Terrific is used to refer to the variables and techniques of the superclass of the cutting-edge object example.

Question 156. What Is A Compilation Unit?

Answer :A compilation unit is a Java source code report.

Question 157. What Interface Is Extended By Awt Event Listeners?

Answer :

All AWT event listeners increase the java.Util.EventListener interface.

Question 158. What Restrictions Are Placed On Method Overriding?

Answer :

Overridden strategies must have the equal name, argument listing, and go back type.

The overriding technique may not restrict the get entry to of the method it overrides.

The overriding method won't throw any exceptions that won't be thrown through the overridden method.

Question 159. How Can A Dead Thread Be Restarted?

Answer :

A useless thread can't be restarted.

Question one hundred sixty. What Happens If An Exception Is Not Caught?

Answer :

An uncaught exception results inside the uncaughtException() approach of the thread's ThreadGroup being invoked, which in the end results in the termination of this system wherein it's far thrown.

Question 161. What Is A Layout Manager?

Answer :A format supervisor is an object this is used to organize components in a container.

Question 162. Which Arithmetic Operations Can Result In The Throwing Of An Arithmeticexception?

Answer :

Integer / and % can result in the throwing of an ArithmeticException.

Question 163. What Are Three Ways In Which A Thread Can Enter The Waiting State?

Answer :

A thread can input the ready state by way of invoking its sleep() technique, through blocking off on I/O, via unsuccessfully attempting to acquire an object's lock, or by using invoking an object's wait() method. It also can input the waiting state via invoking its (deprecated) suspend() method.

Question 164. Can An Abstract Class Be Final?

Answer :

An abstract class might not be declared as final.

Question 165. What Is The Resourcebundle Class?

Answer :

The ResourceBundle magnificence is used to keep locale-unique resources that can be loaded by means of a application to tailor this system's appearance to the specific locale in which it's miles being run.

Question 166. What Happens If A Try-capture-in the end Statement Does Not Have A Catch Clause To Handle An Exception That Is Thrown Within The Body Of The Try Statement?

Answer :

The exception propagates as much as the next higher degree try-capture assertion (if any) or outcomes within the program's termination.

Question 167. What Is Numeric Promotion?

Answer :

Numeric promoting is the conversion of a smaller numeric type to a bigger numeric type, so that integer and floating-point operations may take region. In numerical promotion, byte, char, and short values are converted to int values. The int values also are converted to lengthy values, if vital. The long and drift values are converted to double values, as required.

Question 168. What Is The Difference Between A Scrollbar And A Scrollpane?

Answer :

A Scrollbar is a Component, however now not a Container. A ScrollPane is a Container.

A ScrollPane handles its very own occasions and performs its very own scrolling.

Question 169. What Is The Difference Between A Public And A Non-public Class?

Answer :

A public magnificence may be accessed out of doors of its package.

A personal elegance may not be accessed outdoor of its package.

Question one hundred seventy. To What Value Is A Variable Of The Boolean Type Automatically Initialized?

Answer :

The default price of the boolean kind is false.

Question 171. Can Try Statements Be Nested?

Answer :

Try statements may be tested.

Question 172. What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator?

Answer :

The prefix shape performs the increment operation and returns the value of the increment operation.

The postfix shape returns the cutting-edge price all the expression and then plays the increment operation on that value.

Question 173. What Is The Purpose Of A Statement Block?

Answer :

A assertion block is used to prepare a sequence of statements as a single announcement organization.

Question 174. What Is A Java Package And How Is It Used?

Answer :

A Java bundle is a naming context for lessons and interfaces. A bundle is used to create a separate name space for businesses of classes and interfaces.

Packages also are used to arrange related lessons and interfaces right into a unmarried API unit and to control accessibility to those instructions and interfaces.

Question a hundred seventy five. What Modifiers May Be Used With A Top-level Class?

Answer :

A top-level magnificence may be public, summary, or final.

Question 176. What Are The Object And Class Classes Used For?

Answer :

The Object magnificence is the highest-degree class in the Java magnificence hierarchy. The Class class is used to symbolize the lessons and interfaces which are loaded by means of a Java application..

Question 177. How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception?

Answer :

When an exception is thrown within the body of a attempt announcement, the trap clauses of the attempt declaration are examined within the order wherein they seem. The first capture clause that is able to handling the exception is carried out. The last capture clauses are left out.

Question 178. Can An Unreachable Object Become Reachable Again?

Answer :

An unreachable item might also become accessible once more. This can happen when the object's finalize() approach is invoked and the object performs an operation which causes it to end up available to reachable items.

Question 179. When Is An Object Subject To Garbage Collection?

Answer :

An item is subject to rubbish collection when it will become unreachable to this system in which it's far used.

Question a hundred and eighty. What Method Must Be Implemented By All Threads?

Answer :

All responsibilities ought to enforce the run() technique, whether they're a subclass of Thread or put in force the Runnable interface.

Question 181. What Methods Are Used To Get And Set The Text Label Displayed By A Button Object?

Answer :

getLabel() and setLabel().

Question 182. Which Component Subclass Is Used For Drawing And Painting?

Answer :

Canvas.

Question 183. What Are Synchronized Methods And Synchronized Statements?

Answer :

Synchronized methods are techniques that are used to manipulate get right of entry to to an item. A thread handiest executes a synchronized approach after it has acquired the lock for the method's item or elegance.

Synchronized statements are much like synchronized methods. A synchronized statement can best be finished after a thread has acquired the lock for the item or magnificence referenced within the synchronized assertion.

Question 184. What Are The Two Basic Ways In Which Classes That Can Be Run As Threads May Be Defined?

Answer :

A thread class may be declared as a subclass of Thread, or it can put into effect the Runnable interface.

Question 185. What Are The Problems Faced By Java Programmers Who Don't Use Layout Managers?

Answer :

Without format managers, Java programmers are faced with figuring out how their GUI could be displayed throughout a couple of windowing structures and finding a commonplace sizing and positioning in order to work within the constraints imposed by using every windowing device.

Question 186. What's Java Swing?

Answer :

Swing is basscially a type of Toolkit which is GUI toolkit for Java. It is one part of the Java Foundation Classes (JFC). Swing includes graphical consumer interface (GUI) widgets together with textual content boxes, buttons, break up-panes, and tables.
Swing widgets provide extra sophisticated GUI components than the earlier Abstract Window Toolkit. Since they're written in pure Java, they run the equal on all platforms, unlike the AWT that is tied to the underlying platform's windowing system. Swing supports pluggable appearance and experience � now not by way of using the local platform's facilities, but by means of roughly emulating them. This manner you can get any supported appearance and experience on any platform. The disadvantage of light-weight additives is slower execution. The advantage is uniform behavior on all structures.

Question 187. What Is Jfc?

Answer :

JFC stands for Java Foundation Classes. The Java Foundation Classes (JFC) are a hard and fast of Java magnificence libraries provided as part of Java 2 Platform, Standard Edition (J2SE) to help building pics user interface (GUI) and pics functionality for customer applications a good way to run on famous systems including Microsoft Windows, Linux, and Mac OSX

Question 188. What Is Awt?

Answer :

AWT is bassically stands for Abstract Window Toolkit. AWT permits programmers to expand Java packages with GUI additives, together with windows, and buttons. The Java Virtual Machine (JVM) is liable for translating the AWT calls into the right calls to the host running gadget.

Question 189. What Are The Differences Between Swing And Awt?

Answer :

Many diff are there :
> AWT is heavy-weight components, however Swing is mild-weight additives.
> AWT is OS dependent as it uses local components, But Swing additives are OS independent.
> We can trade the appearance and sense in Swing which is not possible in AWT.
> Swing takes much less memory in comparison to AWT.
> For drawing AWT makes use of display rendering wherein Swing makes use of double buffering.

Question a hundred ninety. What Are Heavy Weight Components ?

Answer :

A Heavyweight issue is bassically associated with its own local screen resource that's typically called a peer.

Question 191. What Is Lightweight Component?

Answer :

A Lightweight factor is the bassically one which "borrows" the screen resource of an ancestor , this means that it has no local aid of its personal -- so it is "lighter".

Question 192. What Is Double Buffering ?

Answer :

Double buffering is bassically the method of use of two buffers in preference to one to briefly preserve data being moved to and from an I/O tool. Double buffering increases records transfer pace due to the fact one buffer may be stuffed while the alternative is being emptied.

Question 193. What Is An Event In Swing?

Answer :

Event is basscially as Changing the kingdom of an object is known as an event.

Question 194. What Is An Event Ha




CFG