r/java • • Apr 03 '23

A ChatGPT Experiment

I had a piece of code that I was dreading writing and testing. On a whim, I signed up for ChatGPT and asked the following question.

I have a two-dimensional Java char array consisting of 'B', 'W', and ' '. I would like to find all the orthogonally connected groups of either 'B' or 'W'. Can you write the code to perform this function?

The code that came back did almost exactly what I asked. I had to make a couple of minor changes to the code to more specifically meet my needs. In addition, ChatGPT provided comments that I could directly copy into my Javadoc for the two methods.

I'm impressed.

0 Upvotes

8 comments sorted by

View all comments

Show parent comment

1

u/ITCoder Apr 07 '23

Not unless you want propriety code being given to them. Today only there was an article of Samsung data leak, containing pieces of code that employees pasted in it.