Java VIVA Questions
1. Why java is Secured Compare with other Language?
2. What if the main method is declared as private?
3. What if the static modifier is removed from the signature of the main
4. What if I write static public void instead of public static void?
5. What if I do not provide the String array as the argument to the
6. What is the first argument of the String array in main method?
7. If I do not provide any arguments on the command line, then the
String array of Main method will be empty or null?
8. What environment variables do I need to set on my machine in order
to be able to run Java programs?
9. Can an application have multiple classes having main method?
10. In how many Ways we can create a Object in java?
11. Every Application Should ve a main() Method under which class does
the main() Method come Under?
12. What is Difference Between Static And Dynamic Polymarphism?
13. What happens If public Static void main() is made protected?
14. Can we Override the Main() Method?
15. What is the name of the java Complier used to compile the Source
File to byte code?
16. what is the use of static data member?
17. What does "wrapping" an object mean?
18. What is the difference between a while statement and a
19. What is Constructor?
20. How are this() and super() used with constructors?
21. What is Difference between the Constructor and the Method?
22. What is the need of calling Default Constructor?
23. What is Difference between Instance and the Object?
24. What is System.Out.Println means?
25. What is JTI (Just in time) Engine means?
26. What is Differences Between Static & Final?
27. What is the difference between static and non-static
28. What is Differences Between class and Package?
29. What is String class?
30. What is Scanner Class in java?
31. What will a Static Variables is loaded ? Is at Compile time or Run
32. What are the Primitive Types in java?
33. What is the difference between an Interface and an Abstract class?
34. What is the purpose of garbage collection in Java, and when is it
35. What is the difference between a constructor and a method?
36. What is an Iterator?
37. State the significance of public, private, protected, default modifiers
both singly and in combination and state the effect of package
relationships on declared items qualified by these modifiers.
38. What is an abstract class?
39. What is static in java?
40. What is final ?
41. What are pass by reference and passby value?
42. Can I have multiple main methods in the same class?
43. How can one prove that the array is not null but empty using one line
44. Do I need to import java.lang package any time? Why ?
45. Can I import same package/class twice? Will the JVM load the
package twice at runtime?
46. What are Checked and UnChecked Exception?
47. What is Overriding?
48. What are different types of inner classes?
49. Does Java provide any construct to find out the size of an object?
50. What are wrapper classes?
51. Why do we need wrapper classes?
52. What are checked exceptions?
53. What are runtime exceptions?
54. What is the difference between error and an exception?? Question:
How to create custom exceptions?
55. If I want an object of my class to be thrown as an exception object,
what should I do?
56. If my class already extends from some other class what should I do if
I want an instance of my class to be thrown as an exception object?
57. How does an exception permeate through the code?
58. What are the different ways to handle exceptions?
59. What is the basic difference between the 2 approaches to exception
handling...1> try catch block and 2> specifying the candidate
exceptions in the throws clause hen should you use which approach?
60. Is it necessary that each try block must be followed by a catch block?
61. If I write return at the end of the try block, will the finally block still
execute?If I write System.exit (0); at the end of the try block, will the
finally block still execute?
62. Are the imports checked for validity at compile time? e.g. will the
code containing an import such as java.lang.ABCD compile?
63. Does importing a package imports the subpackages as well? e.g. Does
importing com.MyTest.* also import com.MyTest.UnitTests.*?
64. What is the difference between declaring a variable and defining a
65. What is the default value of an object reference declared as an
66. Can a top level class be private or protected?
67. What type of parameter passing does Java support?
68. Primitive data types are passed by reference or pass by value?
69. Objects are passed by value or by reference?
70. What is serialization?
71. How do I serialize an object to a file?
72. What happens to the static fields of a class during serialization?
73. Describe synchronization in respect to multithreading.
74. Explain different way of using thread?
75. What is HashMap and Map?
76. Difference between HashMap and HashTable?
77. Difference between Vector and ArrayList?
78. Difference between Swing and Awt?
79. What is synchronization and why is it important?
80. Does garbage collection guarantee that a program will
not run out of
81. How does Java handle integer overflows and
82. What is the difference between preemptive scheduling
and time slicing?
83. When a thread is created and started, what is its initial
84. What is the purpose of finalization?
85. What is the Locale class?
86. What are synchronized methods and synchronized
87. What is daemon thread and which method is used to create the
88. Can applets communicate with each other?