Read objects through the Scanner class

Asked

Viewed 81 times

-1

[![PHOTO OF THE CODE][1]][1]

I am not able to instantiate an object and read it with the method of the Scanner class. It is possible to do something like?

Scanner s = new Scanner (System.in);


Notas notas [] = new Notas [3];

for (int i =0; i< notas){

System.out.println("Digite a nota");
notas[i] = s.nextNotas();

}

In that case, "Grades" would be another class.

1 answer

-2

I believe the best way would be:

for (int i =0; i< notas.size();i++){

System.out.println("Digite a nota " + i);
notas[i] = s.nextInt();

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.