Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Page 1 of 1

fi

fi

fi
on

on

on
C

C
LabExercie_Arrays

1. Write a Java program to create,


l

l
ia

tia

tia

tia
Create and initialize the array using new keyword
Initialize the array values using during creation
nt

en

en

en
Single Dimensional arrays
de

Two Dimensional arrays


fid

fid

fid
Find min and max values of an integer
on

on

on
3. Write a Java program to copy an array into another array
Write a Java program to sort an array without using the sort function
C

C
5. Create an array of 10 elements and initialize with values. Write a program to print the
value of array between index[4] and index[9].
6. Write a Java program with a method. Create an array and pass to your method. The
method should do the following; Move the element in the first index to the second
index.
l

l
tia

tia

tia

tia
7. Find the maximum of an array. Let al] be an array of integers. if n=1, a[0] is the only
number in the array and so, maximum = a[01. if n > 1 , then do the following: find the
n

en

en

en
maximum of n-1 entries of the array. Compare this maximunm with the last entry aln-
de

1] and finalize
fid

fid

fid
8. Write a program to create a package named mypack with a following.
Create a class Diagram, define fields and method to calculate area
on

on

on
Import it in Shape class and display the calculated areas for circle.rectangle,
C

C
square and triangle.
9. Create a package librarybooks:
Create two classes in the package Book and CD
Create a parent class Library which contains the following methods
(note: give your implementation for each of the method.)
l

l
ia

ia

ia

ia
o public static int borrow(int noOfltems)}
o protected static float borrow(int noOf_Items, float deposit){ }
nt

nt

nt

nt
ovoid lend(int items){}
de

Create a child class Books. Do the following,


e
id

id

id
o In the Books class,
f

f
o override the method public static borrow(int noOfltems){}
on

on

on

o invoke the method lend and print the items given to the library class
C

C
l

l
ia

ia

ia

ia
nt

nt

nt

nt
de

e
id

id

id
f

f
on

on

on
C

C
l

l
tia

tia

tia

tia
en

en

en

en

You might also like