Image

JAVA / Code (page 4)

BEGINNER

C 0025 - Array
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    String[] cars = {"BMW", "Toyota", "Audi", "Ford", "Chrysler", "Mazda"};
    cars[0] = "Chevrolet";
    cars[1] = "BMW";
    System.out.println(cars[1]);
  }
}
C 0026 - Variables
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int myNum = 25;
    myNum = 40;
    System.out.println(myNum);
  }
}
C 0027 - Variables
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int w = 26, x = 28, y = 46, z = 32;
    System.out.println(x + w + z);
  }
}
C 0028 - Booleans
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int myLegalage = 36;
    int movieLegalage = 18;
    if (myLegalage >= movieLegalage) {
      System.out.println("Ok ! Enjoy the movie !");
    } else {
      System.out.println("No, sorry ! Go back home and enjoy the Pokemons movie !");
    }  
  }
}
C 0029 - Booleans
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int myLegalage = 12;
    int movieLegalage = 18;
    if (myLegalage >= movieLegalage) {
      System.out.println("Ok ! Enjoy the movie !");
    } else {
      System.out.println("No, sorry ! Go back home and enjoy the Pokemons movie !");
    }  
  }
}
C 0030 - DO WHILE Loop
Reproduce this code (do not copy and paste!).

public class Main {
  public static void main(String[] args) {
    int i = 24;
    do {
      System.out.println("i is " + i);
      i++;
    } while (i < 64);
  }
}
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!

Responsibility

Some of the external links presented below, are not under the direct responsibility of Fond of Code. We cannot therefore be held responsible for the quality/Viability, or the temporary nor permanent interruption of some of them.

All about Java

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
Beta version of the website : May 2024
Implementation : July 2024
Launch of initial activity : 1996 (Europe and North America)
New version of the website : April 2025

Fond of Code official launch : May 2025

Image
Image