0% found this document useful (0 votes)
4 views1 page

Java Assignment

The Java assignment focuses on working with arrays and classes, requiring students to create and manipulate integer and string arrays in separate classes. Additionally, students must create a Student class with specific attributes and a method to display student information, which will be utilized in a MainClass. The completed assignment must be submitted individually by April 2, 2025, at 8 am, along with a report explaining the code.

Uploaded by

Ogunfolajin Dele
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 views1 page

Java Assignment

The Java assignment focuses on working with arrays and classes, requiring students to create and manipulate integer and string arrays in separate classes. Additionally, students must create a Student class with specific attributes and a method to display student information, which will be utilized in a MainClass. The completed assignment must be submitted individually by April 2, 2025, at 8 am, along with a report explaining the code.

Uploaded by

Ogunfolajin Dele
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
You are on page 1/ 1

Java Assignment

Working with Arrays and Classes in Java


Objective:

 Learn how to declare, initialize, and use arrays of primitive data types.
 Understand how to create objects of a class and use them in another class.

Task 1: Working with Arrays

1. Create a Java class called FirstArray.


2. Declare and instantiate an array of integers with 5 elements.
3. Populate the array with values and print them using a loop.

1. Create another Java class called SecondArray.


2. Declare and instantiate an array of strings with 5 elements.
3. Populate the array with values and print them using a loop.

Task 2: Working with Objects

1. Create a class named Student with the following variable:


o
name
o
matricNumber
o
age
o
department
2. Create a method displayInfo() to print student details.
3. Create another class called MainClass
4. In MainClass, create an object of the Student class and use the object to initialize the
variables created in 1 above.
5. Then, call the displayInfo()method to show student details in this format: “My name
is ___, matric number ____. I am ____ years old, and I am from ______ department.”

Run and print the output of your program for submission. Also, write a brief
report to explain each line of your code (as you understand it). Consult your notes
and online resources to complete the assignment.

IT MUST BE DONE INDIVIDUALLY.

To be submitted on Wednesday 2nd April, 2025. 8am.

You might also like