PDF Java Programming 1: Introduction to Java and the Eclipse ...

Java Programming 1: Introduction to Java and the Eclipse Development Environment

Lesso n 1: Int ro duct io n t o J ava Windo ws Settings An Applet Using Eclipse

Our Seco nd Applet Java is an Object-Oriented Language

Structured Pro gramming

Lesson 2: Object -Orient ed Pro gramming Intro ductio n What is Object-Oriented Pro gramming?

Demystifying the Pro gram Reading Code What Abo ut the Other One? Hierarchy Structure in Eclipse

Lesson 3: Applet s Applets What Can Applets Do ? Getting Images

Applet Uses Other Classes

Lesson 4: An Applet 's Lif e Cycle Applets Co ntinued Applet Life Cycle

Adding Metho ds Co ntro l Watching a Life

Lesson 5: Decisio ns, Decisio ns, Decisio ns Pro gram Co ntro l Using If Statements If Statements Placement o f Blo ck Braces

Co mpariso n Operato rs and Lo gic Co mpariso n Operato rs

Lesson 6: Object s and Classes Objects What is an Object? Classes Java Data Types

Lesson 7: Classes and Inst ances Object Design Who gets what?

Initializatio n and Co nstructo rs Making an Applet fo r Dukes Ano ther Applet fo r Dukes

Lesson 8: Using t he API: Int ro duct o ry Graphics Using Java Pro vided Classes java.awt.Graphics Class Using the API Metho ds, Parameters (o r Arguments), and the Do t Operato r Sequencing The java.awt.Co lo r Class

Lesso n 9 : Drawing wit h Graphics Making Pictures Back to Graphics

Lesso n 10 : Me t ho ds and Me t ho d Invo cat io n Metho ds Creating and Using Metho ds Tracing metho d calls

Lesso n 11: Writ ing Classe s - Building Wit h Me t ho ds Mo re o n Metho ds Lo cal Variables Results and Return Building o n metho ds

Overlo ading Ho w Do es Java Find the Right Metho d?

Sum m ary Metho d Declaratio ns main: an impo rtant metho d

Lesso n 12: Adding Int e ract io n using Co m po ne nt s and List e ne rs Revisiting the Dukes Class and Applet A User Mo dificatio n Example Intro ductio n to Interfaces An Analo gy: Antenna as an Interface The Listener Interfaces

Lesso n 13: Mo dularit y: Mo dif ie rs, Pe rm issio ns, and Sco pe Class Specificatio ns Mo dularity Mo difiers Access Mo difiers--Permissio ns What Permissio ns Allo w

Lesso n 14: Class Me m be rs, Co nst ant s and m ain Static Members Static: Making Yo ur Own

static and main Co nstructo rs

Instantiatio n Co nstants use the final mo difier Template and Summary Lesso n 15: All T o ge t he r No w Interactio n and Playing Aro und Putting It All To gether Using Inheritance o n o ur Own

Copyright ? 1998-2014 O'Reilly Media, Inc.

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. See for more information.

Introduction to Java

Welco me to the O'Reilly Scho o l o f Techno lo gy's Java Pro gramming 1 co urse, Intro ductio n to Java and the Eclipse Integrated Develo pment Enviro nment (IDE).

Course Objectives

When yo u co mplete this co urse, yo u will be able to :

build Java applicatio ns and applets in the Eclipse IDE. create co ntro l structures, classes, o bjects, and metho ds. add interactio n to pro grams using co mpo nents and listeners. apply the Java API to draw graphics. demo nstrate understanding o f mo dularity, mo difiers, permissio ns, sco pe, and inheritance.

When yo u co mplete this lesso n, yo u will be able to :

Lesson Objectives

access vario us O'Reilly Scho o l o f Techno lo gy to o ls. define and create an applet.

In this co urse, yo u'll learn the fundamental co ncepts and syntax o f the Java pro gramming language. Thro ugho ut this co urse, yo u will build examples using the Eclipse Java IDE, which is supplied as a Learning Sandbo x. Co mpletio n o f this co urse will give yo u a basic understanding o f Object-Oriented techniques in Java, as well as using the Eclipse IDE.

Fro m beginning to end, yo u'll learn by do ing yo ur o wn Java pro jects, within the Eclipse Learning Sandbo x we affectio nately call "Ellipse." These pro jects will add to yo ur po rtfo lio and pro vide needed experience. All yo u need is a bro wser and internet co nnectio n we pro vide all the so ftware yo u need o nline.

Learning with O'Reilly School of T echnology Courses

As with every O'Reilly Scho o l o f Techno lo gy co urse, we'll take a user-active appro ach to learning. This means that yo u (the user) will be active! Yo u'll learn by do ing, building live pro grams, testing them and experimenting with them-- hands - o n!

To learn a new skill o r techno lo gy, yo u have to experiment. The mo re yo u experiment, the mo re yo u learn. Our system is designed to maximize experimentatio n and help yo u learn to learn a new skill.

We'll pro gram as much as po ssible to be sure that the principles sink in and stay with yo u.

Each time we discuss a new co ncept, yo u'll put it into co de and see what YOU can do with it. On o ccasio n we'll even give yo u co de that do esn't wo rk, so yo u can see co mmo n mistakes and ho w to reco ver fro m them. Making mistakes is actually ano ther go o d way to learn.

Abo ve all, we want to help yo u to learn to learn. We give yo u the to o ls to take co ntro l o f yo ur o wn learning experience.

When yo u co mplete an OST co urse, yo u kno w the subject matter, and yo u kno w ho w to expand yo ur kno wledge, so yo u can handle changes like so ftware and o perating system updates.

Here are so me tips fo r using O'Reilly Scho o l o f Techno lo gy co urses effectively:

T ype t he co de . Resist the temptatio n to cut and paste the example co de we give yo u. Typing the co de actually gives yo u a feel fo r the pro gramming task. Then play aro und with the examples to find o ut what else yo u can make them do , and to check yo ur understanding. It's highly unlikely yo u'll break anything by experimentatio n. If yo u do break so mething, that's an indicatio n to us that we need to impro ve o ur system! T ake yo ur t im e . Learning takes time. Rushing can have negative effects o n yo ur pro gress. Slo w do wn and let yo ur brain abso rb the new info rmatio n tho ro ughly. Taking yo ur time helps to maintain a relaxed, po sitive appro ach. It also gives yo u the chance to try new things and learn mo re than yo u o therwise wo uld if yo u blew thro ugh all o f the co ursewo rk to o quickly. Expe rim e nt . Wander fro m the path o ften and explo re the po ssibilities. We can't anticipate all o f yo ur questio ns and ideas, so it's up to yo u to experiment and create o n yo ur o wn. Yo ur instructo r will help if yo u go co mpletely o ff the rails.

go co mpletely o ff the rails. Acce pt guidance , but do n't de pe nd o n it . Try to so lve pro blems o n yo ur o wn. Go ing fro m misunderstanding to understanding is the best way to acquire a new skill. Part o f what yo u're learning is pro blem so lving. Of co urse, yo u can always co ntact yo ur instructo r fo r hints when yo u need them. Use all available re so urce s! In real-life pro blem-so lving, yo u aren't bo und by false limitatio ns; in OST co urses, yo u are free to use any reso urces at yo ur dispo sal to so lve pro blems yo u enco unter: the Internet, reference bo o ks, and o nline help are all fair game. Have f un! Relax, keep practicing, and do n't be afraid to make mistakes! Yo ur instructo r will keep yo u at it until yo u've mastered the skill. We want yo u to get that satisfied, "I'm so co o l! I did it!" feeling. And yo u'll have so me pro jects to sho w o ff when yo u're do ne.

Windows Settings

If yo u like, yo u can set yo ur o wn Windo ws mo use, keybo ard, and regio n; fo r example, if yo u are left-handed, yo u can switch the left and right butto n functio nality o n the mo use, o r yo u can change date fields to use date fo rmats fo r yo ur lo cal regio n. Click the do wn arro w o n the Windo ws Settings butto n at the to p right o f the screen:

We wo n't discuss the details o f these dialo g bo xes, but feel free to ask yo ur instructo r if yo u have questio ns.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download