|
// Hello World in Java
class HelloWorld {
static public void main(
String args[] ) {
System.out.println(
"Hello World!" );
}
}
|
// Hello World on a mobile Java device
package helloworld;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloWorld extends MIDlet {
public HelloWorld()
{
Form form = new
Form("Hello World");
form.append("Hello
world!");
Display.getDisplay(this).setCurrent(form);
}
protected void pauseApp()
{ }
protected void startApp()
throws
javax.microedition.midlet.MIDletStateChangeException { }
protected void
destroyApp(boolean parm1) throws
javax.microedition.midlet.MIDletStateChangeException
{ }
}
|
<!-- Hello World for Java Server Pages -->
<%@ page language='java' %>
<%="Hello World!" %>
|
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
//
// Hello World Java Servlet
//
public class HelloWorld extends HttpServlet {
public void service(HttpServletRequest request,
HttpServletResponse response)
throws IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><body>");
out.println("Hello World!");
out.println("</body></html>");
}
}
|
// Hello World in Java using Swing GUI
class HelloWorldSwing {
static public void
main(String args[]) {
javax.swing.JOptionPane.showMessageDialog(null,"Hello
world!");
}
}
|
<html>
<body>
<script language="JavaScript"
type="text/javascript">
// Hello World in JavaScript
document.write('Hello World');
</script>
</body>
</html>
No comments:
Post a Comment