CORE JAVA IMPORTANT QUESTIONS
Part 4
Java is one of the most popular programming language. There is a growing demand for Java Developer jobs in technology companies.
This article contains technical most important core java questions that an interviewer asks for Java technology and related topics. Each question is accompanied with an answer so that you can prepare for job interview and clear your concepts in short time.
we have covered almost 500+ important core Java interview questions for freshers and experienced candidates. This post on CORE JAVA Important Questions is prepared to help you understand the basic concepts of Java programming for interview purposes. All the important JAVA concepts are explained here with examples for your easy understanding.This tutorial covers JAVA topics like basic Java definitions, OOP concepts, Access specifiers, Collections, Exceptions, Threads, Serialization, etc., with examples to make you get ready perfectly to face any JAVA interview confidently.
All the best !
Q1. What are wrapped classes?
Wrapped classes are classes that allow primitive types to be accessed as objects.
Q2. 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
Q3. What restrictions are placed on the location of a package statement within a source code file?
A package statement must appear as the first line in a source code file (excluding blank lines and comments
Q4. Can an object's finalize() method be invoked while it is reachable?
An object's finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object's finalize() method may be invoked by other objects.
Q5. What is the immediate superclass of the Applet class?
Panel. It provide the following things:
i) Panels allow us to format the screen. Panels must have a specific layout. If a layout is not specified, the default will be a FlowLayout.
ii) FlowLayout adds components to the screen one after another from top to bottom and from left to right. Components are rearrange when the user resizes the window. FlowLayout may take no arguments.
Constructor: FlowLayout fl = new FlowLayout( );
iii) BorderLayout divides the screen in nine sections based in geographic orientation such as "North", "South", "East"....etc. BorderLayout takes no arguments.
Constructor: BorderLayout bl = new BorderLayout( );
iv) GridLayout divides the screen in the number of sections specified by the programmer. GridLayout takes 2 arguments (#rows, #cols).
Constructor: GridLayout gl = new GridLayout(rows, cols );
Q6. What is the difference between preemptive scheduling and time slicing?
Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
Q7. Name three Component subclasses that support painting.
The Canvas, Frame, Panel, and Applet classes support painting.
Q8. What value does readLine() return when it has reached the end of a file?
The readLine() method returns null when it has reached the end of a file.
Q9. What is the immediate superclass of the Dialog class?
Window class is the immediate superclass of the Dialog class.
Q10. What is clipping?
Clipping is the process of confining paint operations to a limited area or shape.
Q11. What is a native method?
A native method is a method that is implemented in a language other than Java
Q12. Can a for statement loop indefinitely?
Yes, a for statement can loop indefinitely. For example, consider the following:
for(;;) ;
Q13. What are order of precedence and associativity, and how are they used?
Order of precedence determines the order in which operators are evaluated in expressions. Associativity determines whether an expression is evaluated left-to-right or right-to-left
Q14. When a thread blocks on I/O, what state does it enter?
A thread enters the waiting state when it blocks on I/O.
Q15. To what value is a variable of the String type automatically initialized?
The default value of an String type is null.
Recommended Posts
Core Java Important Questions Part 1
Core Java Important Questions Part 2
Core Java Important Questions Part 3
Core Java Important Questions Part 5
Core Java Important Questions Part 6
Core Java Important Questions Part 7
Core Java Important Questions Part 8
Core Java Important Questions Part 9
Core Java Important Questions Part 10
Java Collections Interview Questions Part 1
Java Collections Interview Questions Part 2
Java Collections Interview Questions Part 3
Java MCQs with Answers Set III
If you have any doubts join the discussion below ,our Moderator will reply to your Queries