Here you can find many examples of how to use java simply and effectively
For JavaScript, please click here.
Please take a look at the below examples to help you get started on that next web project where java can make the difference!.
[ Tutorials ] [ FAQs ] [ Examples ]
[ Variables ]
Tutorials
A demo of how to create a java file on the command line, compile it, and execute it.
In this demo you will see an animation that steps you through the basic steps of creating and running a simple java program that displays a dialog box.
Steps:
- Create a java program using a windows command line echo to console redirect
- Compile the java program
- Execute the java program
Here is the animated java demo:
FAQs
Q. What is Java?
A. "
Java is an object-oriented programming language developed primarily by James Gosling and colleagues at Sun Microsystems. The language, initially called Oak (named after the oak trees outside Gosling's office), was intended to replace C++, although the feature set better resembles that of Objective C. Java should not be confused with JavaScript, which shares only the name and a similar C-like syntax." from:
en.wikipedia.org/wiki/Java_(programming_language)
Q. What is a .java file ?
A. A file that ends with the .java extension is probably a java source (code) file. It contains the text version of the program that will be compiled into a run time application or applet. It is the program part.
Q. What is a .class file ?
A. a file that ends with the .class extension is probably a java byte code file. It is the intermediate result of a java source code file compile. It will be interpreted by the java run time machine for the local host's instruction set. It is the executable part.
Examples
Example of the traditional "Hello World" - GUI Version
This example introduces you to the basics.
import java.applet.*;
import java.awt.*;
public class HelloWorld extends Applet
{
public void paint(Graphics g)
{
g.drawString("Hello world!", 50, 25);
}
} |
Example of the traditional "Hello World" - Console Version
This example introduces you to the very basics.
public class HelloWorldApp
{ |
Example of the Web Page that calls a traditional "Hello World"
This example shows the html necessary to present a Java Applet in a web page.
<HTML> |
Example of a way to show a dialog in a java program
This example shows one way to show a pop-up dialog from a Java program.
public class HiDialog
{ |














