Skip to content
Advertisement

Input Object into an array as a List in Java

I am a beginner in Java. I want to get input from the user to a 2D array, and convert into a list of objects.

  • When I hardcoded the data, it could be done as this way

    JavaScript

but, I want to get this object arrays from the user input. When I am going to do this way, it was giving me an error.

  • Code :

    JavaScript
  • Error :

    JavaScript

Can you give me a solution for adding objects as a list from the 2D array that user inputs?

Advertisement

Answer

You can try this way also using bufferedReader,

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement