0% found this document useful (0 votes)
46 views1 page

Exemple Java

The document defines a Java class called Calcul that performs addition of integers. It imports the Scanner class and declares main where it defines and initializes two integers, performs their addition, and prints the result.

Uploaded by

wydad guidali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views1 page

Exemple Java

The document defines a Java class called Calcul that performs addition of integers. It imports the Scanner class and declares main where it defines and initializes two integers, performs their addition, and prints the result.

Uploaded by

wydad guidali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

package [Link].

tp2;
import [Link];

public class Calcul {


Scanner Calcul = new Scanner([Link]);
public static void main(String[] args) {
int a= 7 ;
int b= 6;
int s=a+b;
[Link]("la somme vaut "+s);
}
}
package [Link].tp2;
import [Link];

public class Calcul {


public static void main(String[] args) {
Scanner scanner = new Scanner([Link]);
[Link]("donner nbr: ");
[Link]("donner nombre: ");
int nbr = [Link]();
int nombre = scanner .nextInt();
[Link](" nbr ");
[Link](" nombre ");
int s ;
s=nbr+nombre ;
[Link]("la somme est :"+s);

}
}

You might also like