Programming in Java
Programming in Java
Core Concepts:
3. What are the main features of object-oriented programming (OOP)? Can you
name and describe the four pillars of OOP?
4 What are data types in Java? Mention a few primitive and non-primitive data
iypes.
11. What is the purpose of the final keyword? Explain its use with variables,
12. What is type casting in Java? Explain implicit and explicit casting with
examples.
13. What are wrapper classes, and why are they used?
16. Explain the difference between the == operator and the .equals() method
for comparing objects.
17.What are bitwise operators, and when would you use them?
20. What is short-circuit evaluation in the context of logical operators (&& and
||)?
oe we oN
What are loops (for, while, do-while) used for? When would you use each
type?
6. What are labeled break and continue statements, and how are they used?
7. Explain the concept of "fall-through” in switch statements. How can it be
prevented?
8. What is the purpose of the return statement? Can a void method have a
return statement?
program.
Arrays and Strings:
3. What are some common String manipulation methods (€.g., length (),
substring(), indexo£f() )?
6. What is the default value of elements in an array of int, double, and boolean
types?
7. Can you resize an array after it has been created in Java? Explain your
answer.
8. What are multidimensional arrays? How do you declare and initialize them?
9 What is the enhanced for loop (for-each loop), and how is it used with arrays?
10. What happens if you try to access an element outside the bounds of an array?
11. Explain how to sort an array in Java.
12. How can you search for a specific element within an array?
Strings:
_ What are regular expressions, and how can they be used with strings
in Java?
Object-Oriented Concepts
Inheritance:
ee wf
ao ff wf
Abstraction:
ao fw NM
When would you use an abstract class over an interface, and vice versa?
Encapsulation:
5. What are getter and setter methods, and how do they relate to encapsulation?