TAILIEUCHUNG - Lecture An introduction to Object-Oriented Programming with Java - Chapter 3: Numerical data
After you have read and studied this chapter, you should be able to: Select proper types for numerical data; write arithmetic expressions in Java; evaluate arithmetic expressions, using the precedence rules; describe how the memory allocation works for objects and primitive data values; | Chapter 3 Numerical Data Chapter 3 Objectives After you have read and studied this chapter, you should be able to Select proper types for numerical data. Write arithmetic expressions in Java. Evaluate arithmetic expressions, using the precedence rules. Describe how the memory allocation works for objects and primitive data values. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 3 Objectives, cont. After you have read and studied this chapter, you should be able to Write mathematical expressions, using methods in the Math class. Use the GregorianCalendar class in manipulating date information such as year, month, and day. Use the DecimalFormat class to format numerical data. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 3 Objectives, cont. After you have read and studied this chapter, you should be able to Convert input string values to numerical data. Apply the incremental development technique in writing programs. (Optional) Describe how integers and real numbers are represented in memory. Input data by using and output data using . ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Variables To compute the sum and the difference of x and y in a program, we must first declare what kind of data will be assigned to them. After we assign values to them, we can compute their sum and difference. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Variables When a declaration, such as int x, y; is made, memory locations to store data values for x and y are allocated. These memory locations are called variables, and x and y are the names we associate with the memory locations. ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Variables A variable has three properties: A memory location to store the value. The type of data stored in the memory location. The name used .
đang nạp các trang xem trước