Jump to content

User:Hillgentleman/java

From Wikiversity

A straight path to your first programme in java in Windows, and then on your mobile phone, for absolute beginners.

running Java in windows

[edit]

(see also https://jdk.dev.java.net/ )

  • create the following .java file (taken from wikibooks[1] titled Test.java.
public class Test {
  public static void main(String[] args) {
    int x = 4;
    int y = 4;
    int z = 6;
    x++;
    y *= 2;
    z += x;
    if (x <= y) {
      System.out.println("x is less than or equal to y.");
    }
    if (z <= y) {
      System.out.println("z is less than y.");
    }
    if (x != z) {
      System.out.println("x is not equal to z");
    }
  }
}
  • compile your Test.java with (= open the containing folder, right-click it and open it with) javac.exe, which is probably in the directory C:/Program Files/java/jdk1.6.0_12/bin/javac.exe . The file Test.class will be created.
  • run your Test.class (=open the containing folder, right-click it and open it with) java.exe, which is probably in the directory C:/Program Files/java/jdk1.6.0_12/bin/javac.exe . (or, if you like, open a command line, change into the directory of "Test.class" and type "java Test".)


Further

[edit]

Mobile phone

[edit]

see also

[edit]

Glossary

[edit]

see also wikibooks:Java Programming/Keywords taken from wikibooks/wikiversity/...

Footnotes

[edit]
  1. http://en.wikibooks.org/wiki/Java_Programming/Basic_Arithmetic