# OODP101_Week2.pptx - Object Oriented Design and Programming...

• No School
• AA 1
• 39

This preview shows page 1 - 12 out of 39 pages.

The preview shows page 10 - 12 out of 39 pages.
Object Oriented Design and ProgrammingWeek 2Kent Institute Australia Pty. Ltd.ABN 49 003 577 302CRICOS Code: 00161ERTO Code: 90458TEQSA Provider Number: PRV12051Version 2 – 18thDecember 2015
SLIDE TITLEFarrell, J. (2017) Programming Logicand Design, Comprehensive (9th ed.)Cengage Learning2
Chapter 2-Variables and their manipulationsSimple input and output3Programming Logic and Design, Ninth Edition
ObjectivesIn this chapter, you will learn about:Declaring and using variablesData typesPerforming arithmetic operationsDeclaring and using constantsObject Oriented Programming JAVA basicsSimple input and output4Programming Logic and Design, Ninth Edition
Working with VariablesVariable are named memory locationsContents can vary or differ over timeDeclarationis a statement that provides a variable's:Data type- specify the type of data it will holdsIdentifier - name of variable in memoryOptionally, an initial value5Programming Logic and Design, Ninth Edition
Declaring and Using VariablesWhat are data types?Data type describes:What values can be held by the itemHow the item is stored in memoryWhat operations can be performed on the itemAll programming languages support these data types:Numericconsists of numbers that can be used in mathStringis anything not used in math6Programming Logic and Design, Ninth Edition
Understanding a Declaration’s DataTypeNumeric variableHolds digitsCan perform mathematical operations on itString variableCan hold textLetters of the alphabetSpecial characters such as punctuation marksType-safetyPrevents assigning values of an incorrect data type7Programming Logic and Design, Ninth Edition
Data types in JavaJava has 8 primitive data types-Intfor integer numbers (26,645445)-floatfor floating point numbers (26.5f,6.2f)-doublefor floating point numbers (23.6547132654)-charfor characters (“a”,”b”)-Boolean(True or False)-longfor long integers-Shortfor short integers-Byte8Programming Logic and Design, Ninth Edition
Data Types in JavaWatch this video for understanding data types in better way9
Understanding a Declaration’sIdentifierAnidentifieris a variable’s nameProgrammer chooses reasonable and descriptive names for variablesProgramming languages have rules for creating identifiersMost languages allow letters and digitsSome languages allow hyphensReservedkeywordsare not allowed10Programming Logic and Design, Ninth Edition
Understanding a Declaration’sIdentifier(continued -1)

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 39 pages?