Java Interview Questions & One-Sentence Answers
1. What are the reasons for Java's success?
Ans: Java is successful because it's simple, secure, portable, and platform independent.
2. What is WORA?
Ans: WORA means Write Once, Run Anywhere.
3. Why is Java called an Internet Programming language?
Ans: Java supports applets and web-based apps, making it ideal for the internet.
4. What is meant by platform independence?
Ans: Platform independence means Java runs on any OS with a JVM.
5. What is meant by open source?
Ans: Open source means Java's code is freely available for everyone.
6. What is an assembler?
Ans: Assembler converts assembly code to machine code.
7. What is a compiler?
Ans: Compiler converts high-level code into bytecode.
8. What was Java initially known as?
Ans: Java was initially called Oak.
9. Who were the inventors of Java?
Ans: Java was invented by James Gosling and team.
10. Which company's product was Java initially?
Ans: Java was originally developed by Sun Microsystems.
11. Which company's product is Java currently?
Ans: Now Java is owned by Oracle.
12. What is JVM?
Ans: JVM runs Java bytecode on any platform.
Page 1
Java Interview Questions & One-Sentence Answers
13. Is JVM platform dependent or independent? Why?
Ans: JVM is platform dependent, but it makes Java platform independent.
14. What is a class file?
Ans: A class file is a compiled Java file with bytecode.
15. What is an intermediate code?
Ans: Intermediate code is code between source and machine code (i.e., bytecode).
16. What is class loader?
Ans: Class loader loads compiled classes into memory.
17. What is a byte code verifier?
Ans: Bytecode verifier checks the validity of bytecode.
18. What is an interpreter?
Ans: Interpreter executes code line-by-line at runtime.
19. What is the difference between compiler and interpreter?
Ans: Compiler translates whole code before execution; interpreter does it line-by-line.
20. What is JIT?
Ans: JIT compiles bytecode into native code at runtime for speed.
21. What is JRE?
Ans: JRE allows you to run Java programs.
22. Is Java a compiled or interpreted language?
Ans: Java is both compiled (to bytecode) and interpreted (by JVM).
23. What is run time system?
Ans: Runtime system manages program execution in real-time.
24. What is JDK?
Ans: JDK is a complete toolkit for Java development.
Page 2
Java Interview Questions & One-Sentence Answers
25. What is the latest version of Java available and when was it released?
Ans: Latest Java version changes; check the Oracle site for updates.
26. Which is the next version of Java and when would it be released?
Ans: Next Java version is released every 6 months by Oracle.
27. How did Java drastically grow in features?
Ans: Java grew with rich APIs, GUI, network support, and security.
28. What is the disadvantage of Java?
Ans: Java is slower than C/C++ because of bytecode interpretation.
29. When was first version of Java officially released?
Ans: Java was officially released in 1995.
30. Since when was Java unofficially available?
Ans: Java was unofficially available in 1991 as Oak.
31. Explain the architecture of Java.
Ans: Java's architecture has class loader, bytecode verifier, and JVM.
32. What is meant by architecture neutrality?
Ans: Architecture neutrality means compiled code can run anywhere.
33. How is object file different from class file?
Ans: Object file is native code; class file is bytecode.
34. Is class file platform dependent?
Ans: Class file is platform independent.
35. Is object file platform dependent?
Ans: Object file is platform dependent.
36. Can we have single JVM on a system which has multiple OS?
Ans: One JVM per OS is needed on multi-OS systems.
Page 3
Java Interview Questions & One-Sentence Answers
37. What is meant by a platform?
Ans: A platform is a software-hardware environment.
38. Comment on the speed of Java.
Ans: Java is slower than C++, but fast enough with JIT.
39. What category of applications can be developed using Java?
Ans: Java is used for web, desktop, mobile, and enterprise apps.
40. What is the single most important feature of Java that led to its success?
Ans: Platform independence is Java's best feature.
41. What is the difference between JDK and JVM?
Ans: JDK is for developers; JVM is for running apps.
42. What is meant by loading?
Ans: Loading means bringing code into memory.
43. What is meant by saving?
Ans: Saving means storing data to disk.
44. Why do we have two types of memories in our computer?
Ans: Our computers have RAM and hard disk as two types of memory.
45. Why is the primary memory called as 'main memory'?
Ans: RAM is called main memory because CPU uses it directly.
46. Why is the primary memory called as the 'secondary memory'?
Ans: Hard disk is called secondary memory because it's slower and stores data long-term.
47. Why is hard-disk called as the 'secondary memory'?
Ans: Hard disk stores programs and files permanently.
48. What is a pointer and does Java support pointers?
Ans: Java doesn't support pointers to improve security.
Page 4
Java Interview Questions & One-Sentence Answers
49. What is difference between Path and Classpath?
Ans: Path is for system tools; classpath is for Java files.
50. What environment variables do I need to set on my machine in order to be able to run Java programs?
Ans: Set JAVA_HOME and classpath to compile and run Java.
51. What is an object file?
Ans: Object file contains machine-level code.
52. What is an executable file?
Ans: Executable file runs directly on the system.
53. Is an object file executable?
Ans: Object file is not directly executable.
54. Is an executable file executable?
Ans: Yes, executable files run directly.
55. What is a linkage editor?
Ans: Linker combines files into one program.
56. What is an executable image?
Ans: Executable image is a complete, runnable file.
57. What are library files?
Ans: Library files store reusable code.
58. Do library files contain code in HLL?
Ans: Yes, some libraries may have high-level code (like scripts).
59. Are library files machine dependent?
Ans: Yes, compiled libraries are machine dependent.
60. Why can't we execute an object file?
Ans: Object files need linking, so not directly executed.
Page 5
Java Interview Questions & One-Sentence Answers
61. Can we send HLL code over internet? Comment.
Ans: No, HLL code must be compiled before sending.
62. Can we send MLL code over internet? Comment.
Ans: No, MLL code is not portable over internet.
63. Can we send IL code over internet? Comment.
Ans: IL code can be sent if verified and secure.
64. Why can't we have a single JVM to work for all OS?
Ans: JVMs are OS-specific due to native dependencies.
65. What are the reasons for Java's slowness?
Ans: Java is slow due to runtime checks and bytecode interpretation.
Page 6