当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 2 Intro to Java Programming

资源类别:文库,文档格式:PPTX,文档页数:53,文件大小:2.05MB,团购合买
• Classes & Objects Overview • Packages • Inheritance • Abstraction • Interfaces • Nested Classes Static nested & Inner classes Local & anonymous classes
点击下载完整版文档(PPTX)

Android Programming Lecture 2 Intro to Java Programming

Android Programming Lecture 2 Intro to Java Programming

Agenda Classes Objects Overview Packages ·| nheritance Abstraction Interfaces Nested Classes o Static nested Inner classes o Local anonymous classes

Agenda • Classes & Objects Overview • Packages • Inheritance • Abstraction • Interfaces • Nested Classes o Static nested & Inner classes o Local & anonymous classes 2

Objectives Identify the basic parts of a Java program Can identify a class and components of a class Read the codes in an app

Objectives • Identify the basic parts of a Java program • Can identify a class and components of a class • Read the codes in an app 3

Dot if the baby is within 1-2 years old if the baby is happy today if the milk is still hot else else else else.1 while(the baby is not 6 years old) A computer would ask you to What is a baby Define it What is a feeding bottle? Define it 我们该如何教授计 算机去理解我们? What is milk? Define! 4

4 Do{ if the baby is within 1-2 years old if the baby is happy today if the milk is still hot if … else … else …. else … else…} while(the baby is not 6 years old) A computer would ask you to: • What is a baby? Define it! • What is a feeding bottle? Define it! • What is milk? Define! 我们该如何教授计 算机去理解我们?

Class and object

Class and Object 5

What is an“ Object An object is a thing that we teach to the computer, so that the computer knows what the thing is Unlike people, a computer cannot see, feel and smell. It can only read codes. We have to define objects(or things)by describing the objects using (programming) languages The way we describe a thing is composed of two parts o Attributes(variables, properties ) What an object has o Methods: what an object can do

What is an “Object” • An object is a thing, that we teach to the computer, so that the computer knows what the thing is • Unlike people, a computer cannot see, feel and smell. It can only read codes. We have to define objects (or things) by describing the objects using (programming) languages. • The way we describe a thing is composed of two parts o Attributes (variables, properties): what an object has o Methods: what an object can do 6

Bicycle Music Music Player

7 Bicycle Music Music Player

Example: Bicycle Define the object for computers by specifying o The properties the object has o The functions the object provides Attributes Method o cadence o set cadence o gear o set the gear o speed o speed up o brake

Example: Bicycle 8 • Attributes: o cadence o gear o speed • Method: o set cadence o set the gear o speed up o brake • Define the object for computers by specifying o The properties the object has o The functions the object provides

package com. example test; //A bicycle class Example taken from Oracle Docs public class Bicycle t public int cadence; public int gear public int speed public Bicycle(int startCadence, int startspeed, int startGear) gear startGearj cadence startCadence; speed startspeed public void setCadence(int newValue)t cadence newValue public void setGear(int newValue)i gear newvaluej public void apply Brake(int decrement )i speed - decrement Bicycle public void speedUp(int increment)t speed + increment;

9 Bicycle

package com. example test; //A bicycle class Example taken from Oracle Docs public class Bicycle t Bicycle Class o can be thought of as a template, a prototype or a blueprint of an object o is the fundamental structure in object-oriented programming 10

10 Class o can be thought of as a template, a prototype or a blueprint of an object o is the fundamental structure in object-oriented programming Bicycle

点击下载完整版文档(PPTX)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共53页,可试读18页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有