EECS 1021 Chapter Notes - Chapter 2: Grammar, Computer Programming, Part Of Speech

126 views11 pages

Document Summary

The basic concepts of the java language structure. The primitive java data types and how they are used. Java program bmi example: public class bmicalculator { // declare variables double weight; double height; double bmi; public bmicalculator(double w, double h) { weight = w; height = h; public double calculatebmi() { return weight / (height * height); // this is our main method. public static void main(string[] args) { Statements can start any place of indentation; same idea for extra whitespace, tabs and new lines (the complier ignores it) Improve readability of code by using consistent format style. Each statement must end with semicolon (;) Definition: class is a code container, access modifier specifies which classes have access to it (examples of access modifiers are public, private, etc) The name of the class is followed by the word class. The class definition is enclosed within brackets {: every class definition consists of both variables and methods.

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