Skip to main content

Page I - Java Interview Questions With Answers.

1. What Do You Know About Java?

Answer: Java is a high-level programming language originally developed by Sun Microsystems and released in 1995. Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.

2. What Are The Supported Platforms By Java Programming Language?

Answer: Java runs on a variety of platforms, such as Windows, Mac OS, and the various versions of
UNIX/Linux like HP-Unix, Sun Solaris, Redhat Linux, Ubuntu, CentOS, etc.

3. List Any Five Features Of Java?

Answer: Some features include:
  • Object Oriented.
  • Platform Independent.
  • Robust.
  • Secured & Dynamic.
  • Multi-threaded.

4. Why Is Java Architectural Neutral?

Answer: It’s compiler generates an architecture-neutral object file format, which makes the compiled code to be executable on many processors, with the presence of Java runtime system.

5. How Java Enabled High Performance?

Answer: Java uses Just-In-Time compiler to enable high performance. Just-In-Time compiler is a program that turns Java bytecode, which is a program that contains instructions that must be interpreted into instructions that can be sent directly to the processor.

6. Why Java Is Considered Dynamic?

Answer: It is designed to adapt to an evolving environment. Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run time.

7. What Is Java Virtual Machine & How It Is Considered In Context Of Java’s Platform Independent Feature?

Answer: When Java is compiled, it is not compiled into platform specific machine, rather into platform independent byte code. This byte code is distributed over the web and interpreted by virtual
Machine JVM on whichever platform it is being run.

8. List Two Java IDE’s?

Answer: Netbeans, Eclipse, etc.

9. List Some Java Keywords Unlike C, C + + Keywords?

Answer: Some Java keywords are import, super, finally, etc.

10.What Do You Mean By Object?

Answer: Object is a runtime entity and it’s state is stored in fields and behavior is shown via methods. Methods operate on an object's internal state and serve as the primary mechanism for object to object communication.

11. Define Class?

Answer: A class is a blueprint from which individual objects are created. A class can contain fields and methods to describe the behavior of an object.

12. What Kind Of Variables A Class Can Consist Of?

Answer: A class consist of Local variable, instance variables and class variables.

13. What Is A Local Variable?

Answer: Variables defined inside methods, constructors or blocks are called local variables. The variable will be declared and initialized within the method and it will be destroyed when the method has completed.

14. What Is A Instance Variable?

Answer: Instance variables are variables within a class but outside any method. These variables are
instantiated when the class is loaded.

15. What Is A Class Variable?

Answer: These are variables declared with in a class, outside any method, with the static keyword.

16. What Is Singleton Class?

Answer: Singleton class control object creation, limiting the number to one but allowing the flexibility to create more objects if the situation changes.

17. What Do You Mean By Constructor?

Answer: Constructor gets invoked when a new object is created. Every class has a constructor. If we do not explicitly write a constructor for a class the java compiler builds a default constructor for that class.

18. List The Three Steps For Creating An Object For A Class?

Answer: An Object is first declared, then instantiated and then it is initialized.

19. What Is The Default Value Of Byte Datatype In Java?

Answer: Default value of byte data type is 0.

20. What Is The Default Value Of Float & Double Datatype In Java?

Answer: Default value of float and double data type in different as compared to C/C++. For float it's 0.0f and for double it’s 0.0d

21. When A Byte Datatype Is Used?

Answer: This datatype is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.

22. What Is A Static Variable?

Answer: Class variables also known as static variables are declared with the static keyword in a class, but outside a method, constructor or a block.

23. What Do You Mean By Access Modifier?

Answer: Java provides access modifiers to set access levels for classes, variables, methods and constructors. A member has package or default accessibility when no accessibility modifier is specified.

24. What Is Protected Access Modifier?

Answer: Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class.

25. What Do You Mean By Synchronized Non Access Modifier?

Answer: Java provides these modifiers for providing functionalities other than Access Modifiers, synchronized used to indicate that a method can be accessed by only one thread at a time.


Check Out Other Questions As Well: -


26. According To Java Operator Precedence, Which Operator Is Considered To Be With Highest Precedence?
27. Variables Used In A Switch Statement Can Be Used With Which Data Types?
28. When parseInt Method Can Be Used?
29. Why Is String Class Considered Immutable?
30. Why Is StringBuffer Called Mutable?

31. What Is The Difference Between StringBuffer & StringBuilder Class?
32. Which Package Is Used For Pattern Matching With Regular Expressions?
33. java.util.regex Consists Of Which Classes?
34. What Is Finalize Method?
35. What Is An Exception?

36. What Do You Mean By Checked Exceptions?
37. Explain Runtime Exceptions?
38. Which Are The Two Subclasses Under Exception Class?
39. When throws Keyword Is Used?
40. When throw Keyword Is Used?

41. How finally Keyword Is Used Under Exception Handling?
42. What Things Should Be Kept In Mind While Creating Your Own Exceptions In Java?
43. Define Inheritance?
44. When super Keyword Is Used?
45. What Is Polymorphism?

46. What Is Abstraction?
47. What Is Abstract Class?
48. When Abstract Methods Are Used?
49. What Is Encapsulation?
50. What Is The Primary Benefit Of Encapsulation?

...Return To Java FAQ's Section


Comments

Popular posts from this blog

Tell Me Something About Yourself - Interview Answers.

Try to introduce some of your most important employment-oriented skills as well as your education and accomplishments to the interviewer. Answer to this question is very important because it positions you for the rest of the interview . That's why this statement is often called the "Positioning Statement". One should take the opportunity to show his/her communication skills by speaking clearly and concisely in an organized manner. Since there is no right or wrong answer for this question hence it is important to appear friendly. YOUR ANSWERS CAN BE: 1) I am a person with strong interpersonal skills and have the ability to get along well with people . I enjoy challenges and looking for creative solutions to problems. 2) Besides the details given in my resume, I believe in character values, vision and action. I am quick in learning from mistakes. I am confident that the various tests that you have conducted will corroborate my competencies apti...

What Is (Are) Your Weakness (Weaknesses)? - Interview Answers

There’s a saying – “However small the thorn maybe it has the ability to pierce.” Never say you are a Workaholic, a Perfectionist, etc. because it sounds negative. Try to convert these negative biased qualities into positive ones. For Example, In   place of Workaholic you can say you are a hard worker and always willing to work for extra hours. In place of Perfectionist , you can say you are detail oriented and like to set high standard for work. “Try to specify your weakness as your strength and also highlight it as a benefit.” Your answers can be: 1) One of my weaknesses as I perceive is occasional compromise on time for quality and perfection. 2) I feel I am not very detail-oriented . I’m a person that wants accomplish as much as possible. I realized this hurts quality and therefore I‘m trying hard to find a balance between quality and quantity. 3) At times even when I need help, I try to solve my own problems instead of asking a co-worker who might know...

What Is (Are) Your Strengths? - Interview Answers

This is a simple and popular interview question. Generally people answer it in two ways. There are people who simply state their strength like “I am Young, Dynamic, Intelligent, Smart and so on…”. Such answer is neither right nor wrong but does not help u in any way also. Secondly there are peoples who state their strengths and explain them how he can use his strength for the job and industry. Do not simply state your strength. Everyone has some strength, all you need is to convert them into benefits. In short, try to advertise yourself by converting your features into strengths. “EVERYONE CLAIM THEY ARE HONEST, HARDWORKING, SMART AND SO ON….. BUT WITH AN EXAMPLE IT IS MUCH MORE BELIEVABLE.” Your answers can be : 1) I am a hard worker and because of this ability I can work for additional hours to accomplish my tasks.I am commitment oriented and hence I always enjoy the trust and confidence of my team mates which enables me to perform my duties very easily. 2) I am a...