Server migration authored by Ferret Renaud's avatar Ferret Renaud
<table>
<thead>
<tr>
<th width="200px"><h6>[:rewind: Exo Précédent](/Exo00-Bonjour/1%5D-Installation)</h6></th>
<th colspan="4" width="600px"><h1 align="center">01 - Java - Eclipse</h1></th>
<th width="200px"><h6 align="right">[Exo Suivant :fast_forward:](/Exo02-Point2D/1%5D-Point2D-p1)</h6></th>
</tr>
</thead>
<tbody>
<tr>
<td>&nbsp;</td>
<td align="center">[:one:](/Exo01-Bonjour-Eclipse/1%5D-Installation)<br/>Installation</td>
<td align="center">[:two:](/Exo01-Bonjour-Eclipse/2%5D-Projet-Standard)<br/>Projet Standard</td>
<td align="center">[:three:](/Exo01-Bonjour-Eclipse/3%5D-Projet-Maven)<br/>Projet Maven</td>
<td align="center">:white_check_mark:<br/>Nouvelleclasse</td>
<td>&nbsp;</td>
</tr>
</tbody>
<tfoot>
<tr align="right">
<td colspan="6">
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
</td>
</tr>
</tfoot>
</table>
***
# Classe Java
Que vous ayez un projet Maven ou un projet standard, la création d'une nouvelle classe se fera toujours de la même manière.
Créez une nouvelle classe Java, menu` File/New/Class`
* Donnez-lui un nom de package, par exemple : `fr.exo01`
* Donnez-lui un nom de classe, par exemple `SecondExo`
![img03](uploads/a0dd462e474dfb7aff4a7d42f4f86574/img03.png)
Le dossier où sera créé la classe changera en fonction du type de projet :
* Projet standard Eclipse : dossier **[NomDuProjet]/src**
* Projet Maven : dossier **[artefactId]/src/main/java**
Reprenez le code de la méthode main du premier exercice et placez le dans votre classe.
```java
package fr.exo01;
public class SecondExo {
public static void main(String[] args) {
System.out.println("Bonjour tout le monde");
}
}
```
Sauvegardez votre code (**ctrl + s** ou via le menu faites usage des icônes qui ressemblent à des disquettes)
Il n'y a pas de compilation à proprement parler dans Eclipse, pour compiler il vous suffit de sauvegarder vos fichiers.
Comme nous avons réalisé une classe qui possède une méthode main, nous pouvons l'exécuter.
Faites un clic droit sur votre fichier `SecondExo`
Popup menu `Run As/Java Application`
![eclipse01](uploads/40d9b8e14f0c7be5d568eb74e13e5959/eclipse01.png)
***
<table>
<thead>
<tr>
<th width="200px"><h6>[:rewind: Exo Précédent](/Exo00-Bonjour/1%5D-Installation)</h6></th>
<th colspan="4" width="600px"><h1 align="center">01 - Java - Eclipse</h1></th>
<th width="200px"><h6 align="right">[Exo Suivant :fast_forward:](/Exo02-Point2D/1%5D-Point2D-p1)</h6></th>
</tr>
</thead>
<tbody>
<tr>
<td>&nbsp;</td>
<td align="center">[:one:](/Exo01-Bonjour-Eclipse/1%5D-Installation)<br/>Installation</td>
<td align="center">[:two:](/Exo01-Bonjour-Eclipse/2%5D-Projet-Standard)<br/>Projet Standard</td>
<td align="center">[:three:](/Exo01-Bonjour-Eclipse/3%5D-Projet-Maven)<br/>Projet Maven</td>
<td align="center">:white_check_mark:<br/>Nouvelleclasse</td>
<td>&nbsp;</td>
</tr>
</tbody>
<tfoot>
<tr align="right">
<td colspan="6">
<h6>:copyright: 2019 - <a href="mailto:admin@ferretrenaud.fr">FERRET Renaud</a></h6>
</td>
</tr>
</tfoot>
</table>
\ No newline at end of file