emailconfirmed, nsInternRO, nsInternRW, Administrators
3,356
edits
mNo edit summary |
(Sozusagen fast neu) |
||
Line 11: | Line 11: | ||
(please help in completing this page with a basic introduction to JAVA as seen with [[PHP]] or [[JavaScript]])! | (please help in completing this page with a basic introduction to JAVA as seen with [[PHP]] or [[JavaScript]])! | ||
== Hallo Welt == | |||
<source lang="JAVA"> | |||
class helloWorld { | |||
public static void main(String args[]) { | |||
System.out.println("Hello World!"); | |||
} | |||
} | |||
</source> | |||
Voraussetzung: Das Sun Java SDK ist installiert (oder wir sind auf einer *nix Plattform, auf denen das meistens bereits der Fall ist). | |||
Wir speichern die Datei als "helloWorld.java". Um den Code zu kompilieren und eine ausführbare Datei (Programm) daraus zu machen, rufen wir das Terminal bzw. die Konsole auf und wechseln in das Verzeichnis, in dem helloWorld.java liegt und tippen: <br/> | |||
<tt>javac helloWorld.java</tt><br/> | |||
Jezt sollte eine neue Datei "helloWorld.class" im Verzeichnis zu finden sein. Wir können nun das Programm starten mit: <br/> | |||
<tt>java helloWorld</tt> | |||
<br clear="all"/> | |||
== Primitive Datentypen == | |||
<source lang="JAVA"> | |||
null // 0 bytes 0 bit => 0 | |||
boolean // 1 byte n/a => 0/1; true/false | |||
byte // 1 bytes 8 bit => 0..255 | |||
char // 1 byte 16 bit => Unicode Character (-32768..32767) | |||
short // 2 bytes 16 bit => -32768..32767 | |||
int // 4 bytes 32 bit => -2147483648..2147483647 | |||
float // 4 bytes 32 bit => -3.4028235E+38..3.4028235E+38 | |||
long // 8 bytes 64 bit => (large int) a lot! | |||
double // 8 bytes 64 bit => (large float) a lot! | |||
Array | |||
String | |||
... | |||
</source> | |||
vergleiche auch die C-[[Template:Datatypes|Datentypen]] | |||
== Ressourcen == | |||
* [http://java.sun.com java.sun.com] | |||
* [http://download.oracle.com/javase/tutorial/java/nutsandbolts/index.html The Java Tutorials] - oracle | |||
* [http://openbook.galileocomputing.de/javainsel8/ Galileo Computing: Java ist auch eine Insel] | |||
* [http://www.javacoffeebreak.com/java101/java101.html Java 101] | |||
[[Category:JAVA]] | [[Category:JAVA]] | ||
[[Category:Programmiersprachen]] | [[Category:Programmiersprachen]] |