Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question
100%

Create an array with the values: 99, 55, 87, 21, 3, using any method
 Create a second array
 Copy the elements of the first array to the second
 Change an element of the first array.
 Print both arrays

 I am not able to copy elements

e eclipse-workspace - methods/src/array/gandhrut_Lab7_3.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
D Mylistjava
1 package array;
2 import java.util.Arrays;
3 public class gandhrut_Lab7_3 {
D gandhrut_Lab71.java
D gandhrut_lab75.java
D gandhrut_Lab7_3.java 8
E Package Explorer 8
2 Pro.
@ Jav. O Decl. e Con. 3
v methods
<terminated> gandhrut_Lab7_3 [Java Application] C:\
Array element before change:
First Array: [99, 55, 87, 21, 3]
Second Array: [99, 55, 87, 21, 3]
Array element after change:
> EA JRE System Library [JavaSE-13]
v src
4
v # (default package)
> D methods.java
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] firstArr = {99,55,87,21,3};
50
v 3 array
99 55 77 21 3
> D gandhrut_Lab7_3.java
> D gandhrut_Lab71.java
> D gandhrut_lab75.java
> D Mylist.java
int[] secondArr = new int[5];
10
11
12
13
//Copying the element of first array to second array;
# methods
secondArr = firstArr;
14
15
16
17
18
System.out.println("Array element before change:");
System.out.println("First Array: "+ Arrays.toString(firstArr));
System.out.println("Second Array: "+ Arrays.toString(secondArr));
firstArr [2] = 77;
System.out.println("Array element after change:");
for (int i = 0; i < firstArr.length; i ++)
System.out.print(firstArr[i] +" " );
System.out.println();|
26
27
}
28
29 }
30
25:30 :773
423M of 684M
Writable
Smart Insert
3:31 PM
O Search the web and your PC
(1
1/31/2020
expand button
Transcribed Image Text:e eclipse-workspace - methods/src/array/gandhrut_Lab7_3.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help D Mylistjava 1 package array; 2 import java.util.Arrays; 3 public class gandhrut_Lab7_3 { D gandhrut_Lab71.java D gandhrut_lab75.java D gandhrut_Lab7_3.java 8 E Package Explorer 8 2 Pro. @ Jav. O Decl. e Con. 3 v methods <terminated> gandhrut_Lab7_3 [Java Application] C:\ Array element before change: First Array: [99, 55, 87, 21, 3] Second Array: [99, 55, 87, 21, 3] Array element after change: > EA JRE System Library [JavaSE-13] v src 4 v # (default package) > D methods.java public static void main(String[] args) { // TODO Auto-generated method stub int[] firstArr = {99,55,87,21,3}; 50 v 3 array 99 55 77 21 3 > D gandhrut_Lab7_3.java > D gandhrut_Lab71.java > D gandhrut_lab75.java > D Mylist.java int[] secondArr = new int[5]; 10 11 12 13 //Copying the element of first array to second array; # methods secondArr = firstArr; 14 15 16 17 18 System.out.println("Array element before change:"); System.out.println("First Array: "+ Arrays.toString(firstArr)); System.out.println("Second Array: "+ Arrays.toString(secondArr)); firstArr [2] = 77; System.out.println("Array element after change:"); for (int i = 0; i < firstArr.length; i ++) System.out.print(firstArr[i] +" " ); System.out.println();| 26 27 } 28 29 } 30 25:30 :773 423M of 684M Writable Smart Insert 3:31 PM O Search the web and your PC (1 1/31/2020
e eclipse-workspace - methods/src/array/gandhrut_Lab7_3.java - Eclipse IDE
File Edit Source Refactor Navigate Search Project Run Window Help
D Mylistjava
1 package array;
2 import java.util.Arrays;
3 public class gandhrut_Lab7_3 {
D gandhrut_Lab71.java
D gandhrut_lab75.java
D gandhrut_Lab7_3.java 8
E Package Explorer 8
2 Pro.
@ Jav. O Decl. e Con. 3
v methods
<terminated> gandhrut_Lab7_3 [Java Application] C:\
Array element before change:
First Array: [99, 55, 87, 21, 3]
Second Array: [99, 55, 87, 21, 3]
Array element after change:
> EA JRE System Library [JavaSE-13]
v src
4
v # (default package)
> D methods.java
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] firstArr = {99,55,87,21,3};
50
v 3 array
99 55 77 21 3
> D gandhrut_Lab7_3.java
> D gandhrut_Lab71.java
> D gandhrut_lab75.java
> D Mylist.java
int[] secondArr = new int[5];
10
11
12
13
//Copying the element of first array to second array;
# methods
secondArr = firstArr;
14
15
16
17
18
System.out.println("Array element before change:");
System.out.println("First Array: "+ Arrays.toString(firstArr));
System.out.println("Second Array: "+ Arrays.toString(secondArr));
firstArr [2] = 77;
System.out.println("Array element after change:");
for (int i = 0; i < firstArr.length; i ++)
System.out.print(firstArr[i] +" " );
System.out.println();|
26
27
}
28
29 }
30
25:30 :773
423M of 684M
Writable
Smart Insert
3:31 PM
O Search the web and your PC
(1
1/31/2020
expand button
Transcribed Image Text:e eclipse-workspace - methods/src/array/gandhrut_Lab7_3.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help D Mylistjava 1 package array; 2 import java.util.Arrays; 3 public class gandhrut_Lab7_3 { D gandhrut_Lab71.java D gandhrut_lab75.java D gandhrut_Lab7_3.java 8 E Package Explorer 8 2 Pro. @ Jav. O Decl. e Con. 3 v methods <terminated> gandhrut_Lab7_3 [Java Application] C:\ Array element before change: First Array: [99, 55, 87, 21, 3] Second Array: [99, 55, 87, 21, 3] Array element after change: > EA JRE System Library [JavaSE-13] v src 4 v # (default package) > D methods.java public static void main(String[] args) { // TODO Auto-generated method stub int[] firstArr = {99,55,87,21,3}; 50 v 3 array 99 55 77 21 3 > D gandhrut_Lab7_3.java > D gandhrut_Lab71.java > D gandhrut_lab75.java > D Mylist.java int[] secondArr = new int[5]; 10 11 12 13 //Copying the element of first array to second array; # methods secondArr = firstArr; 14 15 16 17 18 System.out.println("Array element before change:"); System.out.println("First Array: "+ Arrays.toString(firstArr)); System.out.println("Second Array: "+ Arrays.toString(secondArr)); firstArr [2] = 77; System.out.println("Array element after change:"); for (int i = 0; i < firstArr.length; i ++) System.out.print(firstArr[i] +" " ); System.out.println();| 26 27 } 28 29 } 30 25:30 :773 423M of 684M Writable Smart Insert 3:31 PM O Search the web and your PC (1 1/31/2020
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education