CSE 174 Lecture Notes - Lecture 6: Return Statement, Code Reuse

25 views2 pages

Document Summary

Int num = (int) 38. 75; this is needed in order to do int num = 38. 75; (casting) 1 is a string, "1" is a character. ++val1 will run before any other instructions, val1++ after. If you attempt to add int with double value, result will be double. Methods can be individually developed, tested, and reused. User of method (calling method) does not need to know how it works- this is called. Public static int mystery (int a, int b) {}; Signature, return type, method name, argument types, argument variables. Return statement used to send output of type specified. Public keyword means that the method is available to code outside the class. Static keyword means method belongs to a class, not a specific object. Run the method with the argument values in the () The argument (literal) 5 is copied into the parameter variable num that was declared in the.

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