01 intro to using java


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

01 intro to using java

  1. 1. Welcome To <br />Problem Solving<br />Problem Solving<br />with OOP<br />and JAVA<br />with OOP<br />and JAVA<br />
  2. 2. Meet Your Instructor<br />That’s me<br />
  3. 3. Meet Your TA<br />Alisha<br />IDC3931 © PIC<br />
  4. 4. Who Should Drink JAVA?<br />Have you done some programming?<br />Do you want to learn Java?<br />Do you prefer stimulating dinner conversations over coffee to dry, dull, technical lectures?<br />Do you need this course to graduate?<br />Muahahahahaha!<br />IDC3931 © PIC<br />
  5. 5. Who Drinks JAVA?<br />IDC3931 © PIC<br />
  6. 6. IDC3931 © PIC<br />What Is A Computer?<br />A computer is something that takes in information (input), processes it according to a set of instructions (program), and produces a result (output).<br />Computers communicate through a binary alphabet. The letters in this alphabet are ‘0’ and ‘1’. Everything else is made out of these ‘letters’ which are called bits.<br />Bits are represented in a computer by electrical signals: low voltage would mean a ‘0’ and higher voltage a ‘1’. Eight bits gathered together form one byte.<br />
  7. 7. What Is JAVA?<br />Java is a free, open-source, Object Oriented Programming (OOP) language – everything is contained inside classes and objects.<br />Java is überportable – it can run on any machine with a Java Virtual Machine (JVM) installed. <br />No matter what computer you have, you can write the same Java programs.<br />IDC3931 © PIC<br />
  8. 8. How WEuse Java<br />Source Code<br />Virtual <br />Machines<br />Java bytecode<br />Compiler<br />
  9. 9. How WEuse Java<br />Virtual Machines<br />Source Code<br />Java bytecode<br />Compiler<br />IDC3931 © PIC<br />
  10. 10. Code Structure in Java<br />source code<br />class file<br />method 1<br />statement<br />method 2<br />statement<br />statement<br />
  11. 11. What goes in the source file?<br />A source file (with the .java extension) holds one class definition. The class represents a piece of your program, although a very tiny application might need just a single class. The class must go within a pair of<br />public class Bicycle {<br />}<br />curly braces<br />The source file MUST have the same name as the class. For example, the Bicycle class my be stored in the Bicycle.javafile.<br />class<br />A class is the blueprint from which individual objects are created. Think of a bicycle…<br />
  12. 12. What goes in a class?<br />A class has one or more methods. In the Bicycle class, the pedal method will hold instructions for how the Bicycle should pedal. Your methods must be declared inside a class (in other words, within the <br />public class Bicycle{<br /> void pedal( ) {<br /> }<br />}<br />curly braces<br />of the class).<br />method<br />A bicycle might have some methods such as: speedup(), break(), gear(), direction()…<br />
  13. 13. What goes in a method?<br />Within the<br />curly braces<br />public class Dog {<br />void bark ( ) {<br />statement1;<br />statement2;<br /> statement3;<br /> }<br />}<br />public class Bicycle{<br />void pedal( ) {<br />}<br />}<br />of a method, write your instructions for how that method should be performed. Method code is basically a set of statements, and for now you can think of a function or procedure. <br />statement1;<br />statement2;<br />statement3;<br />What are you staring at?<br />statements<br />
  14. 14. One Blueprint Can Be Used To Help Build Different Objects<br />Shape<br />rotate ( )<br />playSound ( )<br />Circle<br />Square<br />Amoeba<br />Triangle<br />This is called inheritance<br />
  15. 15. EVERYTHINGis made from OBJECTS<br />Object<br />equals()<br />getClass()<br />hashCode()<br />toString()<br />Shape<br />rotate()<br />playSound()<br />Circle<br />doSomething()<br />This is the Object class from which ALL other objects are created.<br />
  16. 16. What You Will Get Out Of Learning and Using JAVA!<br />A thorough understanding of Object Oriented Programming.<br />Learn a language that can be run on any platform.<br />Build your programming skills and confidence.<br />Learn how to work and program in groups.<br />Develop Graphical User Interfaces.<br />If you can make it through the day without programming, you haven’t triedJAVA!<br />
  17. 17. Where To Start<br />Setup Eclipse Classic 3.6<br />Write your first Java program<br />Bring your laptops to class every lecture starting next week!<br />