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

Java Array Tutorial PDF

The document provides examples of Java array programs including: checking if an array alternates between positive and negative values; copying an array; finding the maximum and minimum values of an array; removing duplicate elements from an array and returning the new length; and searching a 2D array to return true if a target value is found or false if not.
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)
53 views

Java Array Tutorial PDF

The document provides examples of Java array programs including: checking if an array alternates between positive and negative values; copying an array; finding the maximum and minimum values of an array; removing duplicate elements from an array and returning the new length; and searching a 2D array to return true if a target value is found or false if not.
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 Array Tutorial

1. Write a Java program that checks whether an array of integers alternates between
positive and negative values.
a. Example: Original array: [1, -2, 5, -4, 3, -6] Check the said array of integers
alternates between positive and negative values !true
2. Write a Java program to copy an array by iterating the array.
a. Example: array1:[1,3,5,6,78] copy these element into new array like array2
3. Write a Java program to find the maximum and minimum value of an array.
a. Example : array [23,45,11,9,56] , Maximum value is 56 minimum value is 9
4. Write a Java program to remove the duplicate elements of a given array and return
the new length of the array.
a. Example : Sample array: [20, 20, 30, 40, 50, 50, 50] , After removing the
duplicate elements the program should return 4 as the new length of the array
5. Write the method that searches a 2D array for a target value. Returns true if target is
in the 2D array and false otherwise.
a. Example 2d Array
i. [“Ranil”,”Mahinda” , “Nimal” , Saman”]
ii. [“Anil” , “Sunima”,“Dias”, “Supun”}
b. User should enter the searching name like “Supun”” then if Supun is there
system should return the TRUE

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy