atelier

Java

parcours pratique pour apprendre Java depuis zero

definition d abord

ce que signifie Java

Java sert a ecrire des instructions precises. Ici tu l abordes comme parcours pratique pour apprendre Java depuis zero. Commence par une idee simple: des entrees passent par des etapes et deviennent une sortie.

infos minimalesfichier Main.javaexecuter javac Main.java && java Mainhabitude apprends une petite piece de Java, tape un exemple minimal et execute-le
programme

une suite d instructions executees dans un ordre clair.

valeur et variable

une valeur est une donnee. Une variable est le nom qui la garde.

fonction

un petit travail nomme qui recoit une entree et produit un resultat.

environnement

JDK execute le code de Main.java.

premier code lisible

Class entry

class main method static
class Main {
  public static void main(String[] args) {
    System.out.println(42);
  }
}
sortie 42

lignee du langage

arbre de Java

vois d ou vient Java, quels langages sont proches, et quoi apprendre ensuite.

racines
C++SmalltalkC
actuelJavafamille orientee objet
famillefamille orientee objet
utile pour

utile pour parcours pratique pour apprendre Java depuis zero

parcours debutant

1lire une regle2prevoir la sortie3taper de memoire4lancer la verification5recommencer avec un changement

Banque de questions

Chercher puis pratiquer

Choisis une etape ou cherche dans la banque de ce langage puis ouvre l exercice.

18 resultats
Q 1ChoixEtape 1 definitions

Java question 1

Java question 1. Choisis l explication qui correspond le mieux a main method.

Q 2ChoixEtape 1 definitions

Java question 2

Java question 2. Choisis l explication qui correspond le mieux a print line.

Q 3ChoixEtape 1 definitions

Java question 3

Java question 3. Choisis l explication qui correspond le mieux a class field.

Q 4ChoixEtape 1 definitions

Java question 4

Java question 4. Choisis l explication qui correspond le mieux a constructor this.

Q 5ChoixEtape 1 definitions

Java question 5

Java question 5. Choisis l explication qui correspond le mieux a main method.

Q 6ChoixEtape 1 definitions

Java question 6

Java question 6. Choisis l explication qui correspond le mieux a print line.

Q 7ChoixEtape 1 definitions

Java question 7

Java question 7. Choisis l explication qui correspond le mieux a class field.

Q 8ChoixEtape 1 definitions

Java question 8

Java question 8. Choisis l explication qui correspond le mieux a constructor this.

Q 9ChoixEtape 1 definitions

Java question 9

Java question 9. Choisis l explication qui correspond le mieux a main method.

Q 10ChoixEtape 1 definitions

Java question 10

Java question 10. Choisis l explication qui correspond le mieux a print line.

Q 11ChoixEtape 1 definitions

Java question 11

Java question 11. Choisis l explication qui correspond le mieux a class field.

Q 12ChoixEtape 1 definitions

Java question 12

Java question 12. Choisis l explication qui correspond le mieux a constructor this.

Q 13ChoixEtape 1 definitions

Java question 13

Java question 13. Choisis l explication qui correspond le mieux a main method.

Q 14ChoixEtape 1 definitions

Java question 14

Java question 14. Choisis l explication qui correspond le mieux a print line.

Q 15ChoixEtape 1 definitions

Java question 15

Java question 15. Choisis l explication qui correspond le mieux a class field.

Q 16ChoixEtape 1 definitions

Java question 16

Java question 16. Choisis l explication qui correspond le mieux a constructor this.

Q 17ChoixEtape 1 definitions

Java question 17

Java question 17. Choisis l explication qui correspond le mieux a main method.

Q 18ChoixEtape 1 definitions

Java question 18

Java question 18. Choisis l explication qui correspond le mieux a print line.

choix multiple

Java question 1

Q 1Choixnouveau

Java question 1. Choisis l explication qui correspond le mieux a main method.

public static void main(String[] args) {
  System.out.println(42);
}

reference

modeles pour Main.java

JDKjavac Main.java && java Main
rappel de memoirelis un point puis recris le sans regarder
suivre le codenote les valeurs ligne par ligne avant d executer
taper soi memecopie moins tape plus et corrige un petit bug

class main method static

Class entry

class Main {
  public static void main(String[] args) {
    System.out.println(42);
  }
}
  • The file starts from a class
  • main is the entry point
  • System.out.println prints

int String boolean arrays

Types

int score = 42;
System.out.println(score);
  • Declare types explicitly
  • Use String with capital S
  • Initialize before use

class fields constructor methods

Objects

class User {
  String name;
  User(String name) { this.name = name; }
}
  • Constructor initializes fields
  • this means current object
  • Methods hold behavior