Hello World in Java Languages


Hello World in Java Languages

static public void main( String args[] ) { System.out.println( “Hello World!” ); // Hello World on a mobile Java device import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorld extends MIDlet { 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 { } <%@ page language='java' %> import javax.servlet.http.*; // Hello World Java Servlet public class HelloWorld extends HttpServlet { public void service(HttpServletRequest request, HttpServletResponse response) response.setContentType(“text/html”); PrintWriter out = response.getWriter(); out.println(““); out.println(“Hello World!”); out.println(““); // Hello World in Java using Swing GUI static public void main(String args[]) { javax.swing.JOptionPane.showMessageDialog(null,”Hello world!”);