CSE 142 Lecture 22: Reference Semantics, Array Mystery, & Array Tallying

66 views3 pages
Verified Note

Document Summary

Nove(cid:289)ber (cid:799)4th, (cid:800)(cid:798)(cid:799)8 - refere(cid:290)ce se(cid:289)a(cid:290)tics, array mystery, & array tallyi(cid:290)g. 1 // program showing some additional array practice problems. 2 // each problem is a method, and main contains sample calls. 3 // to those methods to demonstrate their behavior. 7 public static void main(string[] args) { 21 double [] vals = {-10. 2, 3. 5, 9. 7, 12. 5, 1. 3, -0. 4, 11. 1, 10. 0}; 30 // we saw that this is correct code for swapping two int values, but it. 31 // only swaps the local copies of these values and has no effect on any. 32 // variables that are used in calling the method. 33 public static void swap( int x, int y) { 34 system. out. println( "before swap: " + x + " " + y); 38 system. out. println( "after swap: " + x + " " + y); 41 // we saw that this method was able to change the array contents because.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents