Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Handwritten Java Code for Beginners. Includes Arrays, Methods.

Rating
-
Sold
-
Pages
9
Uploaded on
07-05-2026
Written in
2025/2026

This PDF contains a fully solved lab manual on arrays, methods, conditional statements, and loops. Use this as a study guide, and you will learn a lot.

Institution
Course

Content preview

JAVA MATRIX & ARRAY OPERATIONS
Professional Developer Portfolio

Advanced Java Programming Tasks Collection



Prepared By: Student Developer
Subject: Java Programming
Category: Arrays & Matrix Operations
Document Type: Professional Code Documentation
Academic Session: 2026



A professionally formatted collection of Java programming tasks demonstrating array
manipulation, matrix operations, rotations, validations, replacements, and mathematical
computations.


\newpage



Table of Contents
1. Task 1 – Two-Dimensional Array Input & Output
2. Task 2 – Sum & Average of Array Elements
3. Task 3 – Matrix Rotation Program
4. Task 4 – Replace Negative Values with Zero
5. Task 5 – Swap First & Last Row
6. Task 6 – Matrix Addition Program




Task 1 – Two-Dimensional Array Input & Output

import java.util.Scanner;

public class Task1 {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.println("Enter the number of rows: ");
int row = input.nextInt();




1

, System.out.println("Enter the number of columns: ");
int col = input.nextInt();

int[][] array = new int[row][col];


fillArray(array);
printArray(array);
}


static void fillArray(int[][] array) {
Scanner input = new Scanner(System.in);

for (int i = 0; i < array.length; ++i) {
for (int j = 0; j < array[i].length; ++j) {
System.out.println(
"Enter the value for index " + (1 + j) +
" of row at index " + (1 + i) + ": "
);

array[i][j] = input.nextInt();
}
}
}

static void printArray(int[][] array) {
for (int i = 0; i < array.length; ++i) {
for (int j = 0; j < array[i].length; ++j) {
System.out.print(array[i][j] + " ");
}
System.out.println();
}
}
}




Task 2 – Sum & Average of Array Elements

import java.util.Scanner;

public class Task2 {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.println("Enter the number of rows: ");




2

Written for

Institution
Course

Document information

Uploaded on
May 7, 2026
Number of pages
9
Written in
2025/2026
Type
Class notes
Professor(s)
Sir ashfaq nasir
Contains
All classes

Subjects

$6.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
syedaakifazainab

Get to know the seller

Seller avatar
syedaakifazainab GIFT University
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 day
Number of followers
0
Documents
3
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions