Java Interview Questions
1.
How to declare the variable as
constant in core java finally keyword.?
2.
How to display the even numbers?
3.
How to check whether the given number
is prime or not?
4.
Display the first 10 Fibonacci
number.
5.
What is the difference between
static method and instance method?
6.
Find the factorial of a number
by using recursive method.
7.
What is the difference between
method overloading and method overriding?
8.
Can we overload main method?
9.
What is the difference between
JDK, JRE and JVM?
10.
Difference between Abstract
class and interface class?
11.
Can we declare methods without
using abstract keyword within the abstract class?
12.
What is immutable method?
13.
Difference between constructor
and method?
14.
Can we apply overloading
concept on constructor? Give an eg.
15.
What is the use of ‘this’ keyword?
16.
What is the use of super
keyword in a sub-class?
17.
Difference between Call by
value and call by reference. Given an eg for each.
18.
How to make a particular method
as immutable?
19.
Difference between checked and
unchecked exceptions.
20.
Difference between catch block
and final block.
21.
Difference between throw and
throws.
22.
How to create the nested
directories?
23.
How to read all the recursive
directories in a particular directory or drive?
24.
Assume there is a directory.
The directory having ‘n’ number of subdirectory and file(.txt, .xlsx, .csv).
write a program to delete only the excel file
a)within the current
directory
b)within all sub directory.
25.
What is string tokenizer? How
to split the string?
26.
How to split a particular
string by using pattern clause(regular expression)?
27.
Write the regular expression
for date.
28.
Write the regular expression
for 24hurs or 12 hours time format.
29.
Write the regular expression
for IP address.
30.
Write the regular expression
for annogram. The given string is GOD, verify all the possible anagrams.?
31.
The given string is “ software
Testing training” find out necessary
times the ‘t’ ‘s’ ‘a’ as repeated?
32.
The given string is “programming” reverse it without using
reverse.
33.
Difference between ArrayList
and LinkedList.
34.
Difference between HashSet and
TreeSet.
35.
Difference between
Hashmap,Treemap and Hashtable.
36.
How to read the elements which
are stored in hashmap, hashset by using iterator object.
37.
Create a text file and write
the content to a text file in a separate line?
38.
Read the content of text file
each line wise?
39.
Give an example for access
specfier protected, public, default and private modifier?
40.
By using java program approach
explain the stack(pop &push) approach?
41.
Give an example run time
polymorphism?
42.
In a linear Inheritance how the
execution of the constructor taking place? What is constructor Channing?
43.
What is Reflection keyword in
the java?
44.
How to read the excel file values?
45.
Verify the given string is
palindrome or not?
46.
Find out the missing number(assume
numbers 1-10 those are 1,4,5,7,9,10)?
47.
How to convert multiple
inheritance in a java?
48.
A subclass can extend super
class and interface simultaneously?
49.
A Sub class can extend to super
class simultaneously?
50.
Can we declare any instance
variable in interface?
51.
Can we declare the constructor
as final?
52.
On which factor method
overloading can we decide?
53.
By using interface Reference
can we create the object for the class give an example?
54.
Assume Interface is having ten
methods there is one subclass it is implementing only five methods and same
class has its own three methods?
A ) Create the object for
class?
b) Create the object with
respect to interface and execute?
55.
Can we able to create the
object for the abstract class?
56.
What is abstract class?
57.
What is casting?
58.
Fetch the value from the
database by using core java?
59.
Insert the records into the database by using core
java?
60.
Can we read the metadata of the
database?
61.
Give an example for calendar
class?
62.
Give an example for Date format
& SimpleDate format?
63.
Write a method if you pass 80 it has to return 40 and if you pass 40 it
has to return 80?
64.
What is garbage collection?
65.
Can we pass object as parameter
to the method ? give an example?
66.
Can we written object from a
method?
67.
What is inner class?
68.
Write a program to
multiplication of matrix?
69.
How to assign elements to
single dimensional array & two dimensional array?
70.
How to find out the no of
elements stored in a Array?
71.
How to find out the no of characters
string?
72.
How to find out the no of
Elements stored in arraylist & linked list?
73.
How to read Property values
from the property file?
74.
Write values to property file?
75.
How to copy the files from one
directory to another directory?
76.
If there are string values, date
value, numeric ,blank values are available excel file, how to read this?
77.
There is a paragraph it is
containing n number of time “technology” is repeated. find how many times it was repeated (by using regular
expression).
78.
What is difference between
exception and throwable?
79.
In a multiple catch statements
in single try statement can we use multiple catch statements?
a)In a multiple catch
statement the first catch is exception? Does it work?
b)In a multiple catch
statement last catch contain class.
80.
Can we use nested try statement
? give an example.
81.
How to generate the random
number in core java?
82.
What is Object oriented
programming and Object Based programming?
83.
How to pass command line
arguments in core java?
84.
How to import a particular
package?
85.
Display the stars in Equilateral
triangle?
86.
Display the stars in Diamond
,triangle, rectangle shape ?
87.
What is difference between
break and continue? give an example.
88.
Give an example for the
‘toString’ ?
89.
Read the Key and values in the
Hashmap and treemap?
90.
What is difference between
Enumeration and Iteration?
91.
What is difference between
iterator and listiterator?
92.
By using Excel program, whether
the given sheet is available or not.
93.
By using Excel programming
write a method if you pass the column number and row number it has specify the
value.
94.
How to write a value to
specific column number?
95.
Write a program to delete the
particular sheet?
96.
Write a program to add the
particular sheet?
97.
Read the values from Database
table of third column and write to a excel sheet?
98.
Read only the last record from
the database table?
99.
In a single source file can we
able to create to public classes or not?