tailieunhanh - Lecture 1-bis: Language Basics
Lecture 1-bis: Language Basics includes Variables, Operators, Expressions, statements and blocks, Control flow statements, As you learned in the previous lesson, an object stores its state in fields. | Lecture 1-bis: Language Basics Lê Hồng Phương phuonglh@ Department of Mathematics, Mechanics and Informatics, Vietnam National University, Hanoi Content ● Variables ● Operators ● Expressions, statements and blocks ● Control flow statements 2012-2013 2 Content ● Variables ● Operators ● Expressions, statements and blocks ● Control flow statements 2012-2013 3 Variables ● ● ● As you learned in the previous lesson, an object stores its state in fields. In the Java programming language, the terms “field” and “variable” are both used. A field is a kind of variable. public int int int } 2012-2013 class Bicycle { cadence = 0; speed = 0; gear = 1; 4 Kinds of variables ● Instance variables (non-static fields) – ● Non-static fields are called instance variables because their values are unique to each instance of a class. Example: – 2012-2013 The speed of one bike is independent of the speed of .
đang nạp các trang xem trước