1 / 19

Diving in to Java

Diving in to Java. What is Computer Science?. Its all about the science/study to problem solving using computational devices How efficient is the solution? Programming is an artifact which is part of the process a technique. You can say ….

rama-powell
Télécharger la présentation

Diving in to Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Diving in to Java

  2. What is Computer Science? • Its all about the science/study to problem solving using computational devices • How efficient is the solution? • Programming is an artifact which is part of the process a technique

  3. You can say … • Computer Science is just as much about programming as Astronomy is about building telescopes • Astronomy is much more than just building telescopes • It’s a science of studying celestial bodies • Telescopes are just a mechanism to study the science

  4. Modern Days • The computer actually only understands 0’s and 1’s • Binary is a number system that has just 0 and 1. Its base is 2 numbers • So how can we take these commands like move or turn left and turn them into 0’s and 1’s?

  5. Machine Language • Machine language is what the computer understands • What the microprocessor understands • Machine language is defined by which microprocessor you have inside your computer

  6. Can People Write Machine code? • People are really bad when it comes to writing 1’s and 0’s • So we program in what is known as a High Level Language • There are all kinds of HLL’s • One of the high level languages you’re going to learn in this class is Java

  7. Examples of HLL’s • C • C++ • Basic • Fortran

  8. So how do you go from High to Low? • We program in a high level language because its level is higher than that of machine language • There is a translation process • High Level -> Low Level (Machine Level)

  9. Compilation process • To go from a high level to low level is called “Compilation” • This is achieved by a compiler • Eclipse that you have been using along is a compiler • It converts the high level language into something that the machine can understand

  10. As a programmer • You write source code e.g. When you were writing Karel programs • Machine understands object code

  11. Classical Programming Languages

  12. Things get funky in JAVA Some intermediary language also known as Java Byte code

  13. So why have this extra process? • Well guess what? • In the world there are Macs, PC’s, Linux and all kinds of machines • And the 1’s and 0’s that a Mac speaks are different to the 1’s and 0’s that a PC speaks and different to the 1’s and 0’s that the Linux speaks

  14. JVM is essential to run JAVA programs • It is important to install JRE (Java Runtime Environment) • The class file can be run on any computer using the JRE on any machine

  15. Java is Object Oriented • The idea is a program is written in a bunch of classes • Lets refer to Karel • public class KarelProgram extends Karel • Java program is a set of classes

  16. What is a class? • A class is just an encapsulation of some behavior that the program does and data • Like Karel’s programs use some movement so that is behavior and then you have some data

  17. Classes as Hierarchy • Remember you wrote a class which extends Karel and gives you the basic functionality of Karel • And then we extended SuperKarel which gave us even more functions like turnRight Karel SuperKarel Subclass

  18. Super class Karel Super Class Super Karel Sub Class

  19. Example of classes Digest food Blastula stage Animals Warm Blooded Have memory glands Five fingers Highly developed brains Monkeys

More Related