0% found this document useful (0 votes)
4 views2 pages

Java OOP Assignment: Coding Questions

This document outlines an assignment for an Object Oriented Programming course using Java, consisting of various easy-level coding questions. It includes tasks related to classes and objects, constructors, applets, multithreading, and file streams. Students are required to write Java programs to demonstrate their understanding of these concepts.

Uploaded by

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

Java OOP Assignment: Coding Questions

This document outlines an assignment for an Object Oriented Programming course using Java, consisting of various easy-level coding questions. It includes tasks related to classes and objects, constructors, applets, multithreading, and file streams. Students are required to write Java programs to demonstrate their understanding of these concepts.

Uploaded by

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

Object Oriented Programming with Java

Assignment – Easy Level Coding Questions

College: ___________________________

Name: _____________________________

Roll No.: __________________________

Registration No.: ___________________

PART – A : Short Coding Questions

Answer all questions.

1. Class & Object

1. Write a Java program to create a class Student with data members name and roll. Create one
object and display the details.

2. Create a class Rectangle with attributes length and breadth. Add a method to calculate the area.
Create an object and print the result.

3. Define a class Car with a method start() that prints "Car Started". Create an object and call the
method.

2. Constructor & Constructor Overloading

4. Write a Java program with a class Person using:

- A default constructor

- A parameterized constructor

Display values using both constructors.

5. Create a class Box that uses constructor overloading to find:

- Volume of a cube

- Volume of a cuboid

Print both results.

3. Applet Basics

(Write the code only; running is not required.)

6. Write a simple applet program to display "Hello Applet!".


7. Create an applet program to draw a circle and a rectangle.

4. Multithreading

8. Write a Java program to create a thread by extending the Thread class. The thread should print
numbers from 1 to 5.

9. Create two threads:

- Thread 1 prints "Good Morning"

- Thread 2 prints "Welcome"

Run both threads simultaneously.

5. File Streams

10. Write a Java program to create a text file and write "Hello Java" into it.

11. Write a Java program to read data from an existing file and display it.

12. Write a program to copy contents from one file to another using FileInputStream and
FileOutputStream.

End of Question Paper

You might also like