1 / 11

Programming Environments

Programming Environments. DrJava is not Java! It is an integrated environment for developing Java programs DrJava integrates the Edit => Compile => Run cycle Other: jGrasp, BlueJ, Eclipse. IDLE is not Python! It is an integrated environment for

guyb
Télécharger la présentation

Programming Environments

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. Programming Environments • DrJava is not Java! It is an integrated environment for • developing Java programs • DrJava integrates the Edit => Compile => Run cycle • Other: jGrasp, BlueJ, Eclipse • IDLE is not Python! It is an integrated environment for • developing Python programs • IDLE integrates the Edit => Run cycle • Other: DrPython, PyScripter, Eclipse

  2. Edit: create Program.java Compile: create Program.class javac Program.java Run java Program Program.java – human readable Program.class – machine readable Java Program Development Cycle Edit => Compile => Run

  3. Compiled vs Interpreted Language • Compiled – whole program is translated before it can be run; • once compiled can run many times • Ensures that the whole program obeys language rules • Analogy: Translating a book before it can be mass printed • Interpreted – only the line currently executing is translated; • re-translated every time the program is run • Allows for immediate feedback, faster development cycle • Analogy: Translator for a guest speaker

  4. Java Primitive Types • boolean – for true/false values • char – for single character values • short, int, long – for integer values • short [ -32,768 … 32,767 ] • int [ -2,147,483,648 … 2,147,483,647 ] • long [ -9,223,372,036,854,775,808 … 9,223,372,036,854,775,807] • float, double – for real values • float has smaller range than double

  5. In how many ways can you say X = X + 1? X = X + 1; X += 1; X++; ++X; X = X – 1; X = X * 5; X = X / 5; X -= 1; X *= 5; X /= 5; X--; --X;

  6. X++ vs ++X X = 5; X = 5; 2: update the value of X 1: update the value of X Y = X++; Y = ++X; 1: “use” the value of X 2: “use” the value of X Y is now 5 X is now 6 X is now 6 Y is also 6

  7. X++ vs ++X X = 5; X = 5; 2: update X 1: update X System.out.println(X++); System.out.println(++X); 1: “use” the value of X 2: “use” the value of X displays 5 X is now 6 X is now 6 displays 6

  8. Enhanced FOR Loop

  9. Enhanced FOR Loop

  10. Enhanced FOR Loop

  11. In Python

More Related