Vous êtes sur la page 1sur 1

Java Scanner - Citire De La Tastatura

class MyClass {

public static void main(String [] args){

Scanner sc = new Scanner(System.in); /*creez un obiect scan numit


scanner*/

int a = sc.nextInt(); /*citesc de la tastatura in variabila a o


valoare intreaga*/

double b = sc.nextDouble(); /*citesc de la tastatura in variabila b


o valoare de tip double*/

System.out.println(a); /*afisez a*/

System.out.println(b); /*afisez b*/

Citire Vector

alocare spatiu = initializare vector


int[] a = new int[n];
.

a[i] = sc.nextInt();

Citire Matrice

double[][] a = new double[n][n];