M/F 2:30-3:20 |
CS 1130: Transition to OO Programming Spring 2016 |
Main
About: Overview Announcements Staff Consultants Calendar Materials: Texts DrJava Terminology Lectures: In-Class Web-Based VideoNote Assessment: Grading Assignments Labs Resources: CMS Piazza (link) Piazza (about) Java API Style Guide Academic Integrity |
Module 1, Part 4Variables, Declarations, and AssignmentsThis part 4 introduces you to variables, the Java declaration (of a variable), and the assignment statement. We also talk about strong versus weak typing — Java is strongly typed, while Matlab, C, and Python are weakly typed. Contents1. The variable and its declarationWeb Lecture
Reading:
Lecture Notes
(Lecture Slides) Comments: Java's concept of variable is similar to that in most other languages: a named box with a value in it. In Java, a variable must be declared before it is used, and it has a type. 2. The assignment statementWeb Lecture
Reading:
Lecture Notes
(Lecture Notes) Comments: Execution of an assignment statement stores a value in a variable. Learn also about the initializing declaration and narrower and wider types. 3. Promoting and casting
Reading:
Lecture Notes Comments: In several circumstances, Java will automatically promote a value to a wider type. In addition, you, the programmer can explicitly cast a value from one type to another. This lecture explains how and why this is done. 4. char as an integral type.
Reading:
ProgramLive lectures 6-5-2..4 Comments: You are not responsible for this material, but reading it will help you understand how characters are represented. 5. Conditional expressionReading: Lecture Notes Comments: The conditional expression evaluates one of two subexpressions based on a condition (a boolean expression). You will find it useful in the first assignment. 6. Safety and strong typingReading: Lecture Notes Comments: This little essay will give you some understanding of why strong typing is used in DrJava. 7. Self-help exercisesReading: Gries/Gries, Section 1.2.1, pp. 29-30. Comments: It is important that you fully understand declarations and the assignment statement. These exercises will help you in this endeavor. |