Core_Java_Coding_Questions
Core_Java_Coding_Questions
1. Write a Java program to print numbers from 1 to 10, but stop the loop when the number
is 5 using `break`.
3. Write a method that returns the sum of two numbers and call it using the `return`
statement.
4. Write a Java program to search for an element in an array using `break` when the element
is found.
5. Write a Java program that uses `continue` to skip printing vowels from a given string.
6. Create a class `Car` with attributes `model`, `year`, and a method to display details. Create
and use objects of the class.
8. Write a Java program that overloads a method `add()` to handle two integers and three
integers.
9. Write a Java program to demonstrate static variables and static methods in a class
`Counter`.
10. Write a Java program to demonstrate the use of `this` keyword to refer to current class
variables.
11. Write a Java program to demonstrate single inheritance between class `Person` and
subclass `Employee`.
12. Write a Java program to show multilevel inheritance with three classes