下载此文档

麻省理工公开课(精选).pdf


文档分类:外语学习 | 页数:约25页 举报非法文档有奖
1/25
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/25 下载此文档
文档列表 文档介绍
: Java for
Lucy Mendel
MIT EECS
MIT IAP 2006
1
Course Staff
z Lucy Mendel
z Corey McCaffrey
z Rob Toscano
z Justin Mazzola Paluska
z Scott Osler
z Ray He
Ask us for help!
MIT IAP 2006 2
Class Goals
z Learn to program in Java
z Java
z Programming (OOP)
z problem sets are not supposed to take
you 20 hours!
z Tools, concepts, thinking
MIT IAP 2006
3
Logistics
z 5 days long, optional second week
z 2 hrs lecture, 1 hr lab
z End of week might be 1 hr lecture, 2 hr lab
z Breaks!
z Labs
z Work on homework with staff assistance (like LA
hours in )
z Mandatory even for listeners
z Each is expected to take ~1-2 hrs
MIT IAP 2006 4
Object Oriented Programming
z Objects have state
z A person is an object and has a name, age, SS#,
mother, &e.
z Programmers call methods on objects to
compute over and potentially modify that
state
z programmer: How old are you?
z object: I am 22.
z programmer: Today is your birthday!
z object: I have incremented my age by 1.
MIT IAP 2006
5
Java Program
package hello;
import ;
class HelloWorld {
String myString;
void shout() {
myString = new String("Hello, World!“);
(myString);
}
public static void main(String[] args) {
HelloWorld myHelloWorld = new HelloWorld();
();
}
}
MIT IAP 2006 6
Class
z Template for making objects
z Java is about objects Æ everything is in a
class
class HelloWorld { // classname
…<everything> …
}
MIT IAP 2006
7
Field
z Object state
class Human {
int age;
}
<class type> <variable name>;
MIT IAP 2006
8
Making objects
Human lucy = new Human();
z All object creation requires a “new”
z objects = instances (of classes)
z lucy is a pointer to the object
z We assign the constructed object to lucy
<type> <variable name> = <new o

麻省理工公开课(精选) 来自淘豆网www.taodocs.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数25
  • 收藏数0 收藏
  • 顶次数0
  • 上传人jiayaxie935131
  • 文件大小0 KB
  • 时间2015-09-08