Image

Java is an object-oriented programming language created by James Gosling and Patrick Naughton (Sun Microsystems), officially unveiled on May 23, 1995 at SunWorld.

BEGINNER

⇒ Code Examples

→ You must be bilingual (Fr/En). Code examples are in English.

→ Let's start with very simple codes. The more you progress, page after page, the more sophisticated the scripts will be. However, you must go over 30 to 40 pages per level, before moving on to the next step...

→ In order to evaluate your codes, click on the icon on the left at the bottom of the page (gears), then choose a compiler from the list that will be open in another tab. Finally, test your work.

NOW REPRODUCE AND IMMERSE YOURSELF!

C 0001 - Hello World !
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    System.out.println("Hello World");
  }
}
C 0002 - Variables
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    String name = "Joseph";
    System.out.println(name);
  }
}
C 0003 - Strings
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    String txt = "New York";
    System.out.println(txt.toUpperCase());
    System.out.println(txt.toLowerCase());
  }
}
C 0004 - Loops
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int i = 0;
    while (i < 20) {
      System.out.println(i);
      i++;
    }  
  }
}
C 0005 - FOR Loop
Reproduce this code (do not copy and paste!).

for (int i = 0; i < 20; i++) {
  System.out.println(i);
}
C 0006 - Booleans
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int x = 45;
    int y = 22;
    System.out.println(x > y);
  }
}
C 0007 - Comments
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    /* COMMENT
    COMMENT */
    System.out.println("Hello World");
  }
}
C 0008 - Else... If
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int x = 122;
    int y = 36;
    if (x > y) {
      System.out.println("x is greater than y");
    }  
  }
}
Image

CHOOSE YOUR COMPILER

Reproduce this code, choosing one of the compilers below (don't copy and paste! It would be too easy). They all have the same function, just choose one according to your preferences.

When copying your code, replace the existing (default) code already in the compiler with your own.

Warning! For some of these compilers, you must choose the programming language yourself from the menu that is then offered. Of course, don't forget to click on RUN!

Code

Most important versions

Frameworks

Tools/Methodologies

Test

Info+

» Creation date: 1995
* Created by James Gosling and Patrick Naughton
* Developed by Oracle Corporation
* Influenced by Objective C, Pascal...
* Multi-platform

News

The comments you leave us are systematically subject to rigorous moderation. Incivility and slander, threats, intimidation of all kinds, more generally all gratuitous verbal violence, or the dissemination of unverified information... are not tolerated. We also reserve the right to publish only comments which effectively advance the debate and allow a better understanding of the subject covered by the article presented on this page (as well as all its ramifications) and this, whatever its overall content.

Image

Fond of Code TM © ®
All rights reserved - Protected Trademark/Logo (INPI)

Legal structures based in
Nice - FRANCE

Montreal - Canada
By appointment...

SIRET: 41138921600028 (France)
Inc. : 661515-5 (Canada, Qc.)
Official resumption in France: March 2025
Implementation: July 2024
Launch of activity: 1996 (Europe and North America)
New version of the site: April 2025

Image
Image