Difference between revisions of "Programming/Java"

From HPC
Jump to: navigation , search
m (Pysdlb moved page Java to Programming/Java without leaving a redirect)
m
Line 24: Line 24:
  
 
The program would be compiled in the following way, which a choice Java JDK available.
 
The program would be compiled in the following way, which a choice Java JDK available.
* '''Javac''' - is the JAVA byte compiler
+
* <strong>Javac</strong> - is the JAVA byte compiler
* '''Java''' - is the JAVA runtime  
+
* <strong>Java</strong> - is the JAVA runtime  
  
 
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
 
<pre style="background-color: #C8C8C8; color: black; border: 2px solid black; font-family: monospace, sans-serif;">
  
module load java/jdk1.7.0_80 (''or module load java/jdk1.8.0_102'')
+
module load java/jdk1.7.0_80 (or module load java/jdk1.8.0_102)
  
 
javac MyFirstJavaProgram.java
 
javac MyFirstJavaProgram.java

Revision as of 09:36, 31 January 2017

Programming Details

Java is a high-level programming language originally developed by Sun Microsystems and released in 1995.

Java runs on a variety of platforms, including Viper (LInux), Windows, and Mac OS.


Programming example


public class MyFirstJavaProgram {

   /* This is my first java program  */

   public static void main(String []args) {
      System.out.println("Hello World"); // prints Hello World
   }
}

Compilation

The program would be compiled in the following way, which a choice Java JDK available.

  • Javac - is the JAVA byte compiler
  • Java - is the JAVA runtime

module load java/jdk1.7.0_80 (or module load java/jdk1.8.0_102)

javac MyFirstJavaProgram.java
java MyFirstJavaProgram 
Hello World