0% found this document useful (0 votes)
5 views6 pages

Java Questions

Java
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
5 views6 pages

Java Questions

Java
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 6

Basics of JAVA

1)What is JDK?
2)Which is the latest version of JAVA?
3)Explain the advantages of JAVA?
4)Explain JAVAC and JAVA Commands and which folder they are available?
5)What is signature of main method?
6)Explain keyword?list some keywords in JAVA?
7)Explain identifiers in JAVA?
8)Explain about Literals?
9)Explain why JAVA is platform independent?
10)Is JVM platform independent?
11)Explain the difference between compliler and interpreter?
13)What is Rule and Convention?
14)Explain about JRE?
15)explain variables in JAVA and Different types of Variables?
16)Mention all the primitive datatypes in java?
17)Explain about primitive variables?
18)Explain Reference variables?
19)What is String in java?
20)Explain Methods in JAVA and why we use Methods?
21)Write the general Syntax for a method?
22)What is the Default execution method in java?
23)Can we Execute Java Program without main method?
24)Can we Compile Java Program without main method?

Object Oriented Programing

Class and Object

25)Explain what is an Object?


26)Explain What is a Class?
27)Explain Members of a Class?
28)Explain Static Members and Non Static Members of a class?
29)List the Difference between Static and NonStatic Members?
30)Explain About Global variables?
31)Explain How can you access Static Global Variables and NonStatic Global Variables of a
class?
32)What will be the Default values for Global Variables,Reference Variables,Boolean variable?
33)Explain the difference between local and Global Variables?
34)How can You Declare Constant variables in java?
35)Can we just declare a final global variable?
36)Explain About Static Blocks and NonStatic Blocks?
37)When does Static Block get Executed and how many times Static Blocks will be Executed in
one Execution cycle?
38)When does a Non Static Block get Executed and How many times Non Static Blocks will be
Executed in one Execution cycle?
39)What Does a Method Return type Signify?
40)Can we develop a method without Return type?
41)What is the datatype of the reference variable in java?
42)Explain about Constructors and Different types of Constructors?
43)What is the default Constructor?
44)What is Constructor overloading ?Why do we use it?
45)what is this() calling statement?why do we use it?
46)what is Recursion?
47)Recursion while constructor overloading will result in compile time or run time error?
48)what is "this" keyword?
49)Explain the use of this Keyword?
50)Explain about Has-A Relationship?

Inheritance

51)Explain Inheritance and different types of inheritance?


52)Explain the use of extends keyword?
53)Does java support multiple inheritance?justify?
54)Explain about Diamond Ambiguity problem?
55)Explain super() calling Statement and "super" keyword?
56)What is the difference between this() and super() calling statement?
57)What is the difference between this and super keywords?
58)Explain what is Constructor chaining?

Polymorphism

59)Explain method overloading with a real time example?


60)why do we need method Overloading?
61)explain method overriding with real time examples?
62)can we override Static methods?
63)Explain about TypeCasting?
64)Explain Primitive Casting?
65)Explain Auto widening and Explicit Narrowing?
66)Explain Auto upcasting and Explicit Downcasting?
67)can we Achieve Object Casting without inheritance?justify
68)Can we Achieve Downcasting without upcasting?Justify
69)Explain About Polymorphism?
70)Explain Different types of polymorphism?
71)When Does Java throws Class Cast Exception?
72)Explain the use of instanceOf Operator?

Abstraction
** can we initialize final global variables in static and non-static blocks?
73)explain about Abstract methods?
74)what is an Abstract class?
75)Explain why we cannot Instantiate an Abstract class?
76)What is the rule to be followed by the Subclass of an Abstract class?
77)Can abstract Class inherit from another abstract class?
78)Is abstract class 100% abstract ?explain?
79)Explain an interface in java?
80)what is the difference between Abstract class and interface?
81)Does Abstract class have Constructors?if yes why?
82)Do interfaces have constructors?
83)can we instantiate an interface?
84)Explain about implements keyword in java?
85)Can an interface inherit from another interface?
86)Explain Abstraction,Steps to achieve Abstraction and its advantages?
87)Can we develop final methods in interface?
88)Can we develop a final abstract class?
89)can we Develop a static method in abstract class?
90)can we just declare a variable in interface without initializing?

Encapsulation

91)What are the Different access levels in java ?Explain?


92)Explain about Singleton Class?
93)Explain What is Encapsulation?
94)Explain about Java Bean Class?

Libraries

Object class

95)Which is the supermost class for all the classes in Java?


96)Explain "toString()","hashCode()","equals()" of object class?
98)Can subclass overide "toString()","hashCode()","equals()" of Object Class?
99)Explain final method in java?
100)Explain final class in java?
101)what is the use of clone() method?
102)what is a marker interface?
103)Explain about Arrays in java?
104)Explain primitive Array and Derived(Class-type) Array?

String in java

105)Justify how Strings are immutable in Java?


106)can we inherit String class in java?justify.
107)Explain the behaviour of "toString()","hashCode()","equals()" of String Class?
108)Explain String pool area?
109)Explain the difference between "==" operator and .equals() method?
110)List out the difference between String,String builder,and String buffer?

Collection
111)Explain List,Set,Queue type of collection?
112)list out the differences between List,Set,Queue type of collection?
113)Explain the features of ArrayList,LinkedList ?
114)Explain the features HashSet,LinkedHashSet and TreeSet?
115)Explain generics and how to apply it to collection?
116)Explain Boxing and Unboxing in Java?
117)What are Wrapper classes and why its is required?

Exception
118)Explain Exceptions in java?
119)Explain how to handle exceptions?
120)Explain Checked Exceptions and unchecked Exceptions?
121)list out the difference between checked Exceptions and unchecked Exceptions?
122)list out the differences between "throw" and "throws" keywords?
123)Explain the use of finnaly block?
124)Explain the different ways of handling Checked Exceptions?
125)What is the Difference between final ,finally,finalize() in java?

Programming questions:

Collections

1. Program: How to copy or clone a ArrayList?


2. Program: How to find does ArrayList contains all list elements or not?
3. Program: How to copy ArrayList to array?
4. Program: How to shuffle elements in ArrayList?
5. Program: How to swap two elements in a ArrayList?
6. Program: How to copy LinkedList to array?
7. Program: How to get sub list from LinkedList?
8. Program: How to reverse LinkedList content?
9. Program: How to read first element from LinkedList?
10. Program: How to read last element from LinkedList?
11. Program: How to iterate through LinkedList in reverse order?
12. Program: How to copy Set content to another HashSet? 13. Program: How to compare two
sets and retain elements which are same on both sets?
14. Program: How to copy Map content to another HashMap?
15. Program: How to search a key in HashMap?
16. Program: How to search a value in HashMap?
17. Program: How to get all keys from HashMap?
18. Program: How to get entry set from HashMap?
19. Program: How to delete all elements from HashMap?
20. Program: Write a program to remove duplicate entries from an array.
21. Program: Write a program to find duplicate value from an array.
22. Program: How to get subset from sorted set?
23. Program: How to copy Map content to another TreeMap?
24. Program: How to search a key in TreeMap?
25. Program: How to search a value in TreeMap?
26. Program: How to get all keys from TreeMap?
27. Program: How to get entry set from TreeMap?
28. Program: How to get sorted sub-map from TreeMap?
29. Program: How to get first key element from TreeMap (Sorted Map)?
30. Program: How to reverse sorted keys in a TreeMap?
31. Program: How to create synchronized list?
32. Program: How to create synchronized set?
33. Program: How to create synchronized map?
34. Program: How to get max element from the given list?
Strings

1. Write a program to reverse a String

2. Write a program to reverse a String with recursive algorithm?

3. Write a program to reverse first half separately and 2 half separately?


nd

4. Write a program to rotate one char in a given string

5. Find out length of the string without length() method of a String?

6. Find out how many words are there in a given string?

7. Write a java program to find the duplicate words and their number of occurrences in a
string?
8. Write a program to reverse the given string word wise?

9. Rotate the string word wise by one

10. Write a java program to count the total number of occurrences of a given character in a
string?

11. Write a java program to count the number of occurrences of each character in a
string?

12. Write a java program to remove all white spaces from a string?

13. Write a program to check whether given string is a palindrome or not?

14. Write a program to check whether given two strings are anagrams? 15.
Write a java program to reverse each word of a given string?

Arrays:

1. Find the sum of all given elements from an int array?


2. Find the min element from the given int array?
3. Find the max element from the given int array?
4. Find the 2nd min element from the given int array?
5. Find the 2nd max element from the given int array?
6. Find the average value of an int array?
7. Find out the sum of all even indexed elements from a given int array?
8. Find out the sum of all odd indexed elements from a given int array?
9. Find out the min value from all even indexed elements from a given
int array?
10. Find out the max value from all odd indexed elements from a given int
array?
11. Find out the avg value from all even indexed elements from a given int
array?
12. Find out the avg value from all odd indexed elements from a given int
array?
13. Find out the sum of all elements from a first half of given int array?
14. Find out the sum of all elements from a second half of given int array?
15. Find out the min value from a first half of given int array?
16. Find out the min value from a second half of given int array?
17. Find out the max value from a first half of given int array?
18. Find out the max value from a second half of given int array?
19. Find out the avg value from a first half of given int array?
20. Find out the avg value from a second half of given int array?
21. Read all elements from an array in the reverse order?
22. Read first half of the elements in the reverse direction from an array?
23. Read second half of the elements in the reverse direction from an array?
24. Read only even indexed elements from an array?
25. Read only even indexed elements from an array in the reverse order?
26. Read only odd indexed elements from an array?
27. Read only odd indexed elements from an array in the reverse order?
28. Find out an index of a specified element from a given array?
29. Swap two given indexed elements from the array?
30. Reverse the elements of given array?
31. Reverse only first half of the elements of given array?
32. Reverse only last half of the elements of given array?
33. Reverse only even indexed of the elements of given array?
34. Reverse only odd indexed of the elements of given array?
35. Swap odd indexed elements with its immediate next even indexed elements
of given array?
36. Do right shift by one for elements of given array?

You might also like