CSE 8A Chapter Notes - Chapter 3.5: Compile Time

68 views2 pages

Document Summary

Methods - named blocks of command defined in class: sending messages to objects must map to a method object of that class understands, visibility type methodname(parameterlist); Public -> universal access: method return type must match value returned. Otherwise use void: must have () following method name. Declare parameters by declaring variables, then passing the variable name into the () {} -> code block executed when method is called: cannot define methods inside other methods, all variables have a scope (limitation of visibility) Cannot call variables from one method in another. Compiling translates java source code (understood by humans) into a format understood by computers. java files produce . class files at compile time. Get class object with getclass(): every object stores data for its object and contains a reference to class that created it. Object method invoked on can be referred to using this. Can declare a variable anywhere in method"s body: must declare before using it.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents