0% found this document useful (0 votes)
3 views

Core_Java_Coding_Questions

The document contains a list of Java coding questions that cover various programming concepts such as loops, methods, classes, constructors, method overloading, static variables, and inheritance. Each question requires the implementation of specific Java functionalities, including the use of control flow statements like `break` and `continue`. The questions are designed to test the understanding of core Java principles and object-oriented programming.

Uploaded by

csearun877
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Core_Java_Coding_Questions

The document contains a list of Java coding questions that cover various programming concepts such as loops, methods, classes, constructors, method overloading, static variables, and inheritance. Each question requires the implementation of specific Java functionalities, including the use of control flow statements like `break` and `continue`. The questions are designed to test the understanding of core Java principles and object-oriented programming.

Uploaded by

csearun877
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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`.

2. Write a Java program to print odd numbers from 1 to 10 using `continue`.

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.

7. Write a Java program to demonstrate default and parameterized constructors.

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

You might also like