01 intro tousingjava


Published on

Published in: Technology, Education
  • 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 tousingjava

  1. 1. Welcome ToProblem Solving with OOP and Java
  2. 2. Who Should Learn Java?Have you done some programming?Do you want to learn Java?Do you prefer stimulating dinner conversationsover coffee to dry, dull, technical lectures?Do you need this course to graduate?
  3. 3. Java? © PIC 2012
  4. 4. Java?http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  5. 5. What Is A Computer?A computer is something that takes in information(input), processes it according to a set ofinstructions (program), and produces a result(output).Computers communicate through a binaryalphabet. The letters in this alphabet are ‘0’ and‘1’. Everything else is made out of these ‘letters’which are called bits.Bits are represented in a computer by electricalsignals: low voltage would mean a ‘0’ and highervoltage a ‘1’. Eight bits gathered together formone byte. IDC3931 © PIC
  6. 6. What Is JAVA?Java is a free, open-source, Object OrientedProgramming (OOP) language – everything iscontained inside classes and objects.Java isportable – it can run on any machinewith a Java Virtual Machine (JVM) installed.No matter what computer you have, you canwrite the same Java programs.
  7. 7. How WEuse Java V i r t u a Java lSource bytecod MCode e a Compiler c h i n e s
  8. 8. How WEuse Java Virtual MachinesSource Code Java bytecode Compiler
  9. 9. Code Structure in Java Collection of Java filessource contains manycode classes class file A class method aclass.java 1 statement contains many methods and variables method public class aclass{ 2 statement public void statement method() { } }
  10. 10. What goes in the source file?A source file (with the .java extension)holds one class definition. The classrepresents a piece of your program, public class Bicycle {although a very tiny application mightneed just a single class. The class mustgo within a pair of curly braces The source file MUST have the same name as the class. For example, the Bicycle class must be stored in the Bicycle.javafile. } A class is the blueprint from which individual objects are created. clas
  11. 11. What goes in a class?A class has one or more methods. Inthe Bicycle class, the pedal method willhold instructions for how the Bicycle public class Bicycle{should pedal. Your methods must be void pedal( ) {declared inside a class (in other words,within the curly bracesof the class). } A bicycle might have some } methods such as: speedup(), break(), gear(), directi on()… metho
  12. 12. What goes in a method?Within the curly braces public class Dog { Bicycle{ void bark ( )) {{ pedal(of a method, write your instructions for statement1;how that method should be performed. statement1; statement2;Method code is basically a set of statement2; statement3;statements, and for now you can think statement3;of a function or procedure. } } } statemen
  13. 13. One Blueprint Can Be Used To Help Build Different Objects Shape rotate ( ) playSound () This is called inheritanceSquar Circle Amoebae Triangl e
  14. 14. EVERYTHINGis made from OBJECTS Object This is the Object class from which ALL other equals() objects are created. getClass() hashCode() toString() Shape rotate() playSound() Circle doSomething()
  15. 15. What You Will Get Out OfLearning and Using Java!Build your programming skills and confidence.A thorough understanding of Object OrientedProgramming.Learn a language that can be run on any platform.Learn how to work and program in groups.Develop Graphical User Interfaces.
  16. 16. Where To StartSetup Eclipse ClassicWrite your first Java programIf you can, bring your laptops to class everylecture!