CORE JAVA IMPORTANT QUESTIONS
Part 10
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 is the difference between a while statement and a do statement?
A while statement checks at the beginning of a loop to see whether the next loop iteration should occur. A do statement checks at the end of a loop to see whether the next iteration of a loop should occur. The do statement will always execute the body of a loop at least once.
Q2. How are the elements of a GridBagLayout organized?
The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.
Q3. What advantage do Java's layout managers provide over traditional windowing systems?
Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accomodate platform-specific differences among windowing systems.
Q4. What is the Collection interface?
The Collection interface provides support for the implementation of a mathematical bag – an unordered collection of objects that may contain duplicates.
Q5. What modifiers can be used with a local inner class?
A local inner class may be final or abstract.
Q6. 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.
Q7. 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.
Q8. What is the purpose of the File class?
The File class is used to create objects that provide access to the files and directories of a local file system.
Q9. Can an exception be rethrown?
Yes, an exception can be rethrown.
Q10. Which Math method is used to calculate the absolute value of a number?
The abs() method is used to calculate absolute values.
Q11. How does multithreading 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.
Q12. When does the compiler supply a default constructor for a class?
The compiler supplies a default constructor for a class if no other constructors are provided.
Q13. When is the finally clause of a try-catch-finally statement executed?
The finally clause of the try-catch-finally statement is always executed unless the thread of execution terminates or an exception occurs within the execution of the finally clause.
Q14. Which class is the immediate superclass of the Container class?
Component
Q15. If a method is declared as protected, where may the method be accessed?
A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
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 4
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
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