======Java======
[[../sw/java.html|java virtual machine (JVM)]] obecne\\
[[../web/j2ee.html|J2EE]] vyvoj\\
====Obsah:====
[[#odkazy|Externi odkazy]]\\
[[#soubory|Typy souboru]]\\
[[#promenne|Promenne]]\\
[[#operatory|Operatory]]\\
[[#podminky|Podminky, cykly]]\\
[[#tridy|Tridy, objekty, funkce]]\\
[[#priklady|Priklady]]\\
public class trida {
int a; }
Deklarace objektu tridy pokus: cat pokus.java\\
public class pokus {
public static void main {
trida A = new trida();
A.a = 1;
System.Out.Println(A.a);
}
}
Tridy mohou obsahovat i funkce, ktere umi pracovat s promennymy v objektu danne tridy:\\
public class trida {
public int a;
public trida (int a) {
this.a = a; }
public trida () {
this (1); }
public zdvoj () {
a *= 2; }
}
Deklarace objektu tridy pokus: cat pokus.java\\
public class pokus {
public static void main {
trida A = new trida(2);
A.zdvoj();
System.Out.Println(A.a);
}
}
class hello (
public static void main (String[] args){
System.out.println("Hello World");
}
}
==apppletHello.java==
import java.awt.*;
public class apHello extends java.applet.Applet {
public void init (){
add(new Label("Hello World"));
}
}
==appletHello.htm==
<BODY>
<APPLET code="appletHello.class" width="100" height="30" align="left">
aplet appletHello.class neni podporovan prohlizecem
</APPLET>
</BODY>
</HTML>
==servletHello.java==
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*
public class servletHello extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse resopnse) throws IOException {
PrintWriter out = response.getWriter();
java.util.Date today = new java.util.Date();
out.println("Hello, now it is" + today + "