1 / 14

Munz – IT/TG - Lörrach

Programieren in JAVA. Munz – IT/TG - Lörrach. Goals of this “intensive” lecture. To learn: What does it means programming in Java ? What is JAVA good/bad for ? Which programming resources offers JAVA to support “modern” programming ? What is “Object Oriented Programming” ?

vicky
Download Presentation

Munz – IT/TG - Lörrach

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. Programieren in JAVA Munz – IT/TG - Lörrach

  2. Goals of this “intensive” lecture • To learn: • What does it means programming in Java ? • What is JAVA good/bad for ? • Which programming resources offers JAVA to support “modern” programming ? • What is “Object Oriented Programming” ? • You should be able to design, write, debug and run Java programs of “certain” complexity • Learning by example

  3. What means “by Example” • A lot of example programs • Little explanation about the details of the syntax • There will be some slides about the Java syntax after we see the examples (shortly) • You will be confronted with the “practical” problems about programming • The reason of many programming “recipes” will became clear as we learn more • Deductive learning/teaching style

  4. Why is JAVA so Popular ? • Multi-platform • Object oriented: the modern programming paradigm • Robust: avoids programming features which can frequently cause errors, permits recovering from errors. • Aware of the Network: easy for developing distributed systems in a TCP/IP network • It is free and has very good documentation

  5. Some historical facts • Java was conceived in 1990 as a microchip programming language for domestic appliances • Java means “coffee” in the USA (programmers drink lot of coffee) • As such it has had not much acceptance (yet) • It was seen that the same characteristics are good for a multi-platform language • The Applets made Java famous

  6. What do I need to develop Java programs • There are many commercial and free developing environments • We will use the most simple and sure, but may be not the most efficient way to develop big applications • We need: • A text editor • The compiler • The JVM The JDK or SDK

  7. How do I write and run a Java Stand-alone Program ? MyProg.class Java VM (java) MyProg.java class { int i,j; public main Java Java compiler (javac) Java source code

  8. How do I write and run a Java-Applet ? MyApplet.class MyApplet.java class { int i,j; public main Java VM (inside the browser) Java source code Java compiler (javac)

  9. What makes Java Multi-platform Java compiler (specific for each platform) javac P1.java Program’s output P1.java P1.class Java interpreter (specific for each platform) also called Java Virtual Machine java P1

  10. How do I get the JDK ?(outside the school) • You can download the JDK from http://java.sun.com/ • There are different versions of JAVA • 1.Java 1.0.x Original version, largely been replaced. • 2.Java 1.1.x Major upgrade from 1.0. (double) Many things in the earlier were deprecated in this version. They still exist and can be used, but there are new (and often better) ways of doing the same things. • 3.Java 1.2.x. Known as Java 2. Doubled the sizeand capabilities of the previous version. This version can be downloaded as an SDK (Software Development Kit). An SDK is the same thing as a JDK, only the name was changed. • 4.Java 1.3.x This version is also known as Java 2, Version 1.3. It is alsoknown as J2SE which stands for Java 2 Standard Edition. • 5.Java 1.4.x This has been released as a beta version

  11. Java compared to C

  12. Lecture Content • Einfaches programieren in Java (mit Hilfe der Class Console für I/O) • Variabeln, aritmehmetische Ausdrücke, Datentypen, casts, Bedingungen, Schleifen, Verzweigungen • String-Operationen, Text-orientiertes I/O auf Dateien • Weitere Klassen, package Konzept • Statische Methoden • Class-orientiertes programieren • Klassendefinitionen und Zugriffsrechte • Vererbung, Interfaces und Polymorphie • Graphics und Graphische Schnittstellen

  13. Mein Erstes Programm in Java public classProgramm1{ public static void main(String args[]) { Consolec = new Console(); c.print("Hallo, tipp ein Nummer ein ?"); intdeinnummer = c.readInt(); intmeinnummer = deinnummer+1; c.println(" Mein Nummer lautet " + meinnumer); c.println("Also ich gewinne Diesmal") } } Blau: standart Rot: Datentypen Grün: Variabeln

  14. Mein Zweites Programm public classProgramm2{ public static void main(String args[]) { Consolec = new Console(); c.print("Hallo, wie heist du ?"); Stringname = c.readString(); c.print("Wann bist Du geboren ? (Jahr) "); intjahr = c.readInt(); c.println(name+", also du bist ungefähr "+ (2001-jahr)+" alt "); } } Blau: standart Rot: Datentypen Grün: Variabeln

More Related