COMPSCI 61B Lecture Notes - Lecture 1: Semicolon

13 views3 pages

Document Summary

Hello world: all code in java must be a part of a class. We delimit the beginning and end of segments of code using { and } All statements in java must end in a semi-colon: create main method inside the class for code to run. Static typing: must declare the variable and set the variable. Must specify a type and a name (ex. Int x: once a type is speci ed, it can never change, types are veri ed before the code even runs. Gets a certi cate of correctness before code can even run. Declaring functions: function must also be in class. Function that is part of a class is called a method so all functions in java are methods: syntax. Parameters of a function must have a declared type as well as the return value: main code runs program, functions in java return only one value, comments on code describing the function is convention.

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

Related Questions