This is a minimal usage of Java, but it does not demonstrate object-oriented programming well. No object is explicitly created since the keyword new> is never used.
// Hello.java public class Hello { public static void main(String[] args) { System.out.println("Hello, World!"); } }To execute this program, one first saves the above code as a file named
Hello.java
. One then compiles it to bytecode:$ javac Hello.java
which produces a file named Hello.class
. This class is then launched with the java launcher (usually named java, java.exe, or some variant depending on the operating system).$ java Hello
Hello, World!
$
1 komentar:
Artikel-artikel di blog ini bagus-bagus. Coba lebih dipopulerkan lagi di Lintasberita.com akan lebih berguna buat pembaca di seluruh tanah air. Dan kami juga telah memiliki plugin untuk Blogspot dengan installasi mudah. Salam!
http://www.lintasberita.com/Teknologi/Contoh_Java/
Posting Komentar