Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to give comma seperated values of any data type as input in java?

+1 vote
asked Apr 9, 2023 by 21A31A05G5 (130 points)

1 Answer

0 votes
answered Apr 12, 2023 by Peter Minarik (86,240 points)
The question is not too specific.

I'm not a Java developer, but I suppose Java has similar functionality as other languages. So there may already be an existing parser that does this for you.

If not, you can write your own. You'd need to split up the text alongside the commas (this would probably return an array of strings), then read every segment (every element in the array) individually and parse the expected type. You have to know the expected type, the computer cannot guess what type it is you'd have there (reliably).
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...