Präsentation herunterladen
Die Präsentation wird geladen. Bitte warten
Veröffentlicht von:Meino Boehner Geändert vor über 11 Jahren
1
Munz – IT/TG - Lörrach
2
Goals of this intensive lecture To learn: 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 You should be able to design, write, debug and run Java programs of certain complexity Learning by example Learning by example
3
What means by Example A lot of example programs A lot of example programs Little explanation about the details of the syntax Little explanation about the details of the syntax There will be some slides about the Java syntax after we see the examples (shortly) 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 You will be confronted with the practical problems about programming The reason of many programming recipes will became clear as we learn more The reason of many programming recipes will became clear as we learn more Deductive learning/teaching style Deductive learning/teaching style
4
Why is JAVA so Popular ? Multi-platform Multi-platform Object oriented: the modern programming paradigm Object oriented: the modern programming paradigm Robust: avoids programming features which can frequently cause errors, permits recovering from errors. 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 Aware of the Network: easy for developing distributed systems in a TCP/IP network It is free and has very good documentation 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 was conceived in 1990 as a microchip programming language for domestic appliances Java means coffee in the USA (programmers drink lot of coffee) Java means coffee in the USA (programmers drink lot of coffee) As such it has had not much acceptance (yet) As such it has had not much acceptance (yet) It was seen that the same characteristics are good for a multi-platform language It was seen that the same characteristics are good for a multi-platform language The Applets made Java famous The Applets made Java famous
6
What do I need to develop Java programs There are many commercial and free developing environments 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 will use the most simple and sure, but may be not the most efficient way to develop big applications We need: 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.java Java source code Java compiler (javac) class { int i,j; public main MyProg.class Java Java VM (java)
8
How do I write and run a Java-Applet ? MyApplet.java Java source code Java compiler (javac) class { int i,j; public main MyApplet.class Java VM (inside the browser)
9
What makes Java Multi- platform Java compiler (specific for each platform) javac P1.java javac P1.java P1.javaP1.class Java interpreter (specific for each platform) also called Java Virtual Machine java P1 Programs output
10
How do I get the JDK ? (outside the school) You can download the JDK fromhttp://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 size and 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 also known 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 JAVAC speed - interpreted + directly executed versatility - code must fit for every computer + access to low level programming res. standardiza tion + Java is the same everywhere - each C compiler has some differences Multi- platform + the same source and java code - similar source code but different object code Robustness + no tricky prog. - Allows hackering Network + part of the language - different libraries Other libs + a lot and standard +- a lot but not standard
12
Lecture Content Einfaches programieren in Java (mit Hilfe der Class Console für I/O) Einfaches programieren in Java (mit Hilfe der Class Console für I/O) Variabeln, aritmehmetische Ausdrücke, Datentypen, casts, Bedingungen, Schleifen, Verzweigungen Variabeln, aritmehmetische Ausdrücke, Datentypen, casts, Bedingungen, Schleifen, Verzweigungen String-Operationen, Text-orientiertes I/O auf Dateien String-Operationen, Text-orientiertes I/O auf Dateien Weitere Klassen, package Konzept Weitere Klassen, package Konzept Statische Methoden Statische Methoden Class-orientiertes programieren Class-orientiertes programieren Klassendefinitionen und Zugriffsrechte Klassendefinitionen und Zugriffsrechte Vererbung, Interfaces und Polymorphie Vererbung, Interfaces und Polymorphie Graphics und Graphische Schnittstellen Graphics und Graphische Schnittstellen
13
Mein Erstes Programm in Java public class Programm1 { public static void main(String args[]) { public static void main(String args[]) { Console c = new Console(); c.print("Hallo, tipp ein Nummer ein ?"); int deinnummer = c.readInt(); int meinnummer = 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 class Programm2 { public static void main(String args[]) { public static void main(String args[]) { Console c = new Console(); c.print("Hallo, wie heist du ?"); String name = c.readString(); c.print("Wann bist Du geboren ? (Jahr) "); int jahr = c.readInt(); c.println(name+", also du bist ungefähr "+ (2001-jahr)+" alt "); }} Blau: standart Rot: Datentypen Grün: Variabeln
Ähnliche Präsentationen
© 2025 SlidePlayer.org Inc.
All rights reserved.