JavaInterviewQuestion Theory

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

JAVA INTERVIEW QUESTIONS (THEORY)

1. What is Java? Can you explain features of Java?


2. What is the difference between JVM, JRE, and JDK?
3. What is the difference between interpreter and compiler?
4. What is .class file?
5. What are primitive and non-primitive data types I Java?
6. What is the difference between = and ==?
7. What is the difference between pre-increment and post increment operator
in java?
8. What is difference between object oriented programming language and
object based programming language?
9. What is type casting?
10. What is the difference between while and do..while loops?
11. What is an array?
12. How to check length of an array?
13. What are the different ways of defining an array variable?
14. How to store multiple data type values in an array?
15. How to read array elements?
16. What are the types of arrays?
17. What is the difference between for loop and for..each loop?
18. What is the output of following code?

public class Example {


public static void main(String[] args) {
for(int i=1;i<=7;i++){
if(i==5){
break;
}
System.out.println(i);
}
}
}
19. What is the output of following code?
public class Example {
public static void main(String[] args)
{
for(int i=1;i<=7;i++){ if(i==5){
continue;
}
System.out.println(i);
}
}
}
20. Explain String methods in Java?
21. How to concat two strings in Java?
22. How to compare two strings in Java?
23. How to find length of a string?
24. How to print current date and time in Java?
25. What is class and object?
26. What is java method?
27. What is instantiation in java?
28. What is call by value and call by reference?
29. What is constructor in java?
30. What is use of constructors?
31. What are the types of constructors available in java?
32. What is Polymorphism in Java?
33. What is method overloading?
34. Can we overload main method?
35. Can we overload constructor?
36. What id use of this keyword?
37. What is the use of static keyword in java?
38. What is Inheritance in java? What are the types of inheritance?
39. What is method overriding?
40. What is use of super keyword?
41. How to achieve multiple inheritance in java?
42. What is interface?
43. What is the default access modifier of interface variables and methods?
44. What is the usage of final variable at variable, method level and class level?
45. What is abstract method?
46. What is java package?
47. How to import external package?
48. What are the access modifiers in java?
49. What is the default access modifier in java?
50. What is exception? What are the types of exceptions in java?
51. What is the advantage of Exception Handling?
52. What are the different ways of handling exceptions?
53. What is use of finally block in exception handling?
54. Explain final and finally keywords in java?
55. What is difference between array and arraylist in java?
56. How to declare arraylist in java?
57. How to read elements from arraylist?
58. How to check number of elements presents in array list?
59. How to remove all the elements from array list?
60. How to insert elements to arraylist?
61. What is hashmap?
62. What is keyset in hashmap?
63. What is JDBC? Explain how to connect to database using JDBC program?

You might also like